{"action":"created","issue":{"url":"https://api.github.com/repos/cakephp/cakephp/issues/12024","repository_url":"https://api.github.com/repos/cakephp/cakephp","labels_url":"https://api.github.com/repos/cakephp/cakephp/issues/12024/labels{/name}","comments_url":"https://api.github.com/repos/cakephp/cakephp/issues/12024/comments","events_url":"https://api.github.com/repos/cakephp/cakephp/issues/12024/events","html_url":"https://github.com/cakephp/cakephp/issues/12024","id":318906365,"node_id":"MDU6SXNzdWUzMTg5MDYzNjU=","number":12024,"title":"Update to 3.6.2 breaks forms validation","user":{"login":"mirko-pagliai","id":293199,"node_id":"MDQ6VXNlcjI5MzE5OQ==","avatar_url":"https://avatars3.githubusercontent.com/u/293199?v=4","gravatar_id":"","url":"https://api.github.com/users/mirko-pagliai","html_url":"https://github.com/mirko-pagliai","followers_url":"https://api.github.com/users/mirko-pagliai/followers","following_url":"https://api.github.com/users/mirko-pagliai/following{/other_user}","gists_url":"https://api.github.com/users/mirko-pagliai/gists{/gist_id}","starred_url":"https://api.github.com/users/mirko-pagliai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mirko-pagliai/subscriptions","organizations_url":"https://api.github.com/users/mirko-pagliai/orgs","repos_url":"https://api.github.com/users/mirko-pagliai/repos","events_url":"https://api.github.com/users/mirko-pagliai/events{/privacy}","received_events_url":"https://api.github.com/users/mirko-pagliai/received_events","type":"User","site_admin":false},"labels":[{"id":60504544,"node_id":"MDU6TGFiZWw2MDUwNDU0NA==","url":"https://api.github.com/repos/cakephp/cakephp/labels/Defect","name":"Defect","color":"f7c6c7","default":false},{"id":60525626,"node_id":"MDU6TGFiZWw2MDUyNTYyNg==","url":"https://api.github.com/repos/cakephp/cakephp/labels/Need%20more%20information","name":"Need more information","color":"eb6420","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/cakephp/cakephp/milestones/173","html_url":"https://github.com/cakephp/cakephp/milestone/173","labels_url":"https://api.github.com/repos/cakephp/cakephp/milestones/173/labels","id":3413121,"node_id":"MDk6TWlsZXN0b25lMzQxMzEyMQ==","number":173,"title":"3.6.6","description":"Bugfixes for 3.6.","creator":{"login":"markstory","id":24086,"node_id":"MDQ6VXNlcjI0MDg2","avatar_url":"https://avatars3.githubusercontent.com/u/24086?v=4","gravatar_id":"","url":"https://api.github.com/users/markstory","html_url":"https://github.com/markstory","followers_url":"https://api.github.com/users/markstory/followers","following_url":"https://api.github.com/users/markstory/following{/other_user}","gists_url":"https://api.github.com/users/markstory/gists{/gist_id}","starred_url":"https://api.github.com/users/markstory/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markstory/subscriptions","organizations_url":"https://api.github.com/users/markstory/orgs","repos_url":"https://api.github.com/users/markstory/repos","events_url":"https://api.github.com/users/markstory/events{/privacy}","received_events_url":"https://api.github.com/users/markstory/received_events","type":"User","site_admin":false},"open_issues":39,"closed_issues":25,"state":"open","created_at":"2018-06-10T01:40:19Z","updated_at":"2018-06-20T18:56:55Z","due_on":"2018-06-24T07:00:00Z","closed_at":null},"comments":19,"created_at":"2018-04-30T14:18:06Z","updated_at":"2018-06-21T14:46:42Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"This is a (multiple allowed):\r\n\r\n* [x] bug\r\n* [ ] enhancement\r\n* [ ] feature-discussion (RFC)\r\n\r\n* CakePHP Version: 3.6.2\r\n\r\n### What you did\r\nI have a `Form`:\r\n\r\n```\r\nclass ContactUsForm extends Form\r\n{\r\n    use MailerAwareTrait;\r\n\r\n    protected function _buildValidator(Validator $validator)\r\n    {\r\n        // some validation rules...\r\n\r\n        return $validator;\r\n    }\r\n\r\n    protected function _execute(array $data)\r\n    {\r\n        return $this->getMailer('ContactUs')->send('contactUsMail', [$data]);\r\n    }\r\n}\r\n```\r\n\r\n### What happened\r\nUpdating from `3.6.1` to `3.6.2`, the `_buildValidator()` method is executed, but all validation rules are ignored.\r\n\r\nAll tests fail. For example, if I add the rule:\r\n\r\n        $validator->requirePresence('first_name');\r\n\r\nThis test:\r\n\r\n        debug($this->ContactUsForm->validate([]));\r\n        dd($this->ContactUsForm->errors());\r\n\r\nTurns out:\r\n\r\n```\r\n########## DEBUG ##########\r\ntrue\r\n###########################\r\ntests/TestCase/Form/ContactUsFormTest.php (line 84)\r\n########## DEBUG ##########\r\n[]\r\n###########################\r\n```\r\n\r\nInstead with the `3.6.1` version everything works correctly.\r\n"},"comment":{"url":"https://api.github.com/repos/cakephp/cakephp/issues/comments/399129834","html_url":"https://github.com/cakephp/cakephp/issues/12024#issuecomment-399129834","issue_url":"https://api.github.com/repos/cakephp/cakephp/issues/12024","id":399129834,"node_id":"MDEyOklzc3VlQ29tbWVudDM5OTEyOTgzNA==","user":{"login":"liviascapin","id":7348876,"node_id":"MDQ6VXNlcjczNDg4NzY=","avatar_url":"https://avatars1.githubusercontent.com/u/7348876?v=4","gravatar_id":"","url":"https://api.github.com/users/liviascapin","html_url":"https://github.com/liviascapin","followers_url":"https://api.github.com/users/liviascapin/followers","following_url":"https://api.github.com/users/liviascapin/following{/other_user}","gists_url":"https://api.github.com/users/liviascapin/gists{/gist_id}","starred_url":"https://api.github.com/users/liviascapin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/liviascapin/subscriptions","organizations_url":"https://api.github.com/users/liviascapin/orgs","repos_url":"https://api.github.com/users/liviascapin/repos","events_url":"https://api.github.com/users/liviascapin/events{/privacy}","received_events_url":"https://api.github.com/users/liviascapin/received_events","type":"User","site_admin":false},"created_at":"2018-06-21T14:46:42Z","updated_at":"2018-06-21T14:46:42Z","author_association":"CONTRIBUTOR","body":"Hey folks,\r\n\r\nWe ran into a kind of similar problem today. I don't think it's the same problem (or maybe it is?), but it might help someone who stumbles upon this thread as I did. I was updating our application from 3.5.17 to 3.6.5 and the buildValidator methods were not called anymore, there simply was no validation. I tried around a bit and noticed that it was working in 3.6.1 but stopped working in 3.6.2.\r\n\r\nWhen debugging I noticed that the Form.buildValidator event wasn't processed properly, because there was no listener for it. That didn't make much sense, so I checked it and noticed that the event stuff gets initialized in the constructor, which we overwrote without calling parent, because we probably forgot.\r\n\r\nThus I learned that if you overwrite the constructor of Form without calling the parent constructor, your validation will break in versions of CakePHP > 3.6.1."}}
{"actor":{"display_login":"liviascapin"}}