{"action":"created","comment":{"url":"https://api.github.com/repos/cakephp/cakephp/pulls/comments/211459354","pull_request_review_id":147882679,"id":211459354,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMTQ1OTM1NA==","diff_hunk":"@@ -706,6 +706,341 @@ public function testAllowEmptyAsArrayFailure()\n         $validator->allowEmpty(['title' => 'derp', 'created' => false]);\n     }\n \n+    /**\n+     * Tests the allowEmptyString method\n+     *\n+     * @return void\n+     */\n+    public function testAllowEmptyString()\n+    {\n+        $validator = new Validator();\n+        $validator->allowEmptyString('title')\n+            ->scalar('title');\n+\n+        $this->assertTrue($validator->isEmptyAllowed('title', true));\n+        $this->assertTrue($validator->isEmptyAllowed('title', false));\n+\n+        $data = [\n+            'title' => '',\n+        ];\n+        $this->assertEmpty($validator->errors($data));\n+\n+        $data = [\n+            'title' => null,\n+        ];\n+        $this->assertEmpty($validator->errors($data));\n+\n+        $data = [\n+            'title' => [],\n+        ];\n+        $this->assertNotEmpty($validator->errors($data));\n+\n+        $validator = new Validator();\n+        $validator->allowEmptyString('title', 'update', 'message');\n+        $this->assertFalse($validator->isEmptyAllowed('title', true));\n+        $this->assertTrue($validator->isEmptyAllowed('title', false));\n+\n+        $data = [\n+            'title' => null,\n+        ];\n+        $expected = [\n+            'title' => ['_empty' => 'message'],\n+        ];\n+        $this->assertSame($expected, $validator->errors($data, true));\n+        $this->assertEmpty($validator->errors($data, false));\n+    }\n+\n+    /**\n+     * Tests the allowEmptyArray method\n+     *\n+     * @return void\n+     */\n+    public function testAllowEmptyArray()\n+    {\n+        $validator = new Validator();\n+        $validator->allowEmptyArray('items')\n+            ->hasAtMost('items', 3);\n+\n+        $this->assertTrue($validator->field('items')->isEmptyAllowed());\n+\n+        $data = [\n+            'items' => '',\n+        ];\n+        $result = $validator->errors($data);\n+        $this->assertEmpty($result);\n+\n+        $data = [\n+            'items' => null,\n+        ];\n+        $result = $validator->errors($data);\n+        $this->assertEmpty($result);\n+\n+        $data = [\n+            'items' => [],\n+        ];\n+        $result = $validator->errors($data);\n+        $this->assertEmpty($result);\n+\n+        $data = [\n+            'items' => [1, 2, 3, 4, 5],\n+        ];\n+        $result = $validator->errors($data);\n+        $this->assertNotEmpty($result);","path":"tests/TestCase/Validation/ValidatorTest.php","position":101,"original_position":101,"commit_id":"ba2f4d9eea1b3622b195126ecdbce2b057d4896d","original_commit_id":"0e5d9dcc58b9d8eae6684c64f9b4b5e5136d9330","user":{"login":"chinpei215","id":7399393,"node_id":"MDQ6VXNlcjczOTkzOTM=","avatar_url":"https://avatars2.githubusercontent.com/u/7399393?v=4","gravatar_id":"","url":"https://api.github.com/users/chinpei215","html_url":"https://github.com/chinpei215","followers_url":"https://api.github.com/users/chinpei215/followers","following_url":"https://api.github.com/users/chinpei215/following{/other_user}","gists_url":"https://api.github.com/users/chinpei215/gists{/gist_id}","starred_url":"https://api.github.com/users/chinpei215/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chinpei215/subscriptions","organizations_url":"https://api.github.com/users/chinpei215/orgs","repos_url":"https://api.github.com/users/chinpei215/repos","events_url":"https://api.github.com/users/chinpei215/events{/privacy}","received_events_url":"https://api.github.com/users/chinpei215/received_events","type":"User","site_admin":false},"body":"What message should we report to users?","created_at":"2018-08-21T02:03:14Z","updated_at":"2018-08-21T02:03:14Z","html_url":"https://github.com/cakephp/cakephp/pull/12486#discussion_r211459354","pull_request_url":"https://api.github.com/repos/cakephp/cakephp/pulls/12486","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/cakephp/cakephp/pulls/comments/211459354"},"html":{"href":"https://github.com/cakephp/cakephp/pull/12486#discussion_r211459354"},"pull_request":{"href":"https://api.github.com/repos/cakephp/cakephp/pulls/12486"}},"in_reply_to_id":211457104},"pull_request":{"url":"https://api.github.com/repos/cakephp/cakephp/pulls/12486","id":209510982,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA5NTEwOTgy","html_url":"https://github.com/cakephp/cakephp/pull/12486","diff_url":"https://github.com/cakephp/cakephp/pull/12486.diff","patch_url":"https://github.com/cakephp/cakephp/pull/12486.patch","issue_url":"https://api.github.com/repos/cakephp/cakephp/issues/12486","number":12486,"state":"open","locked":false,"title":"Add allowEmptyByFlags() and type-specific allowEmpty*() methods","user":{"login":"chinpei215","id":7399393,"node_id":"MDQ6VXNlcjczOTkzOTM=","avatar_url":"https://avatars2.githubusercontent.com/u/7399393?v=4","gravatar_id":"","url":"https://api.github.com/users/chinpei215","html_url":"https://github.com/chinpei215","followers_url":"https://api.github.com/users/chinpei215/followers","following_url":"https://api.github.com/users/chinpei215/following{/other_user}","gists_url":"https://api.github.com/users/chinpei215/gists{/gist_id}","starred_url":"https://api.github.com/users/chinpei215/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chinpei215/subscriptions","organizations_url":"https://api.github.com/users/chinpei215/orgs","repos_url":"https://api.github.com/users/chinpei215/repos","events_url":"https://api.github.com/users/chinpei215/events{/privacy}","received_events_url":"https://api.github.com/users/chinpei215/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-08-20T12:52:38Z","updated_at":"2018-08-21T02:03:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"70cc2f4cf214c775a0524a8606f88bbe7bc33bca","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":60504418,"node_id":"MDU6TGFiZWw2MDUwNDQxOA==","url":"https://api.github.com/repos/cakephp/cakephp/labels/validation","name":"validation","color":"FFFFFF","default":false}],"milestone":{"url":"https://api.github.com/repos/cakephp/cakephp/milestones/179","html_url":"https://github.com/cakephp/cakephp/milestone/179","labels_url":"https://api.github.com/repos/cakephp/cakephp/milestones/179/labels","id":3546626,"node_id":"MDk6TWlsZXN0b25lMzU0NjYyNg==","number":179,"title":"3.6.11","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":31,"closed_issues":14,"state":"open","created_at":"2018-08-05T02:00:40Z","updated_at":"2018-08-21T01:30:46Z","due_on":"2018-09-01T07:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/cakephp/cakephp/pulls/12486/commits","review_comments_url":"https://api.github.com/repos/cakephp/cakephp/pulls/12486/comments","review_comment_url":"https://api.github.com/repos/cakephp/cakephp/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cakephp/cakephp/issues/12486/comments","statuses_url":"https://api.github.com/repos/cakephp/cakephp/statuses/ba2f4d9eea1b3622b195126ecdbce2b057d4896d","head":{"label":"chinpei215:validation-spoofing","ref":"validation-spoofing","sha":"ba2f4d9eea1b3622b195126ecdbce2b057d4896d","user":{"login":"chinpei215","id":7399393,"node_id":"MDQ6VXNlcjczOTkzOTM=","avatar_url":"https://avatars2.githubusercontent.com/u/7399393?v=4","gravatar_id":"","url":"https://api.github.com/users/chinpei215","html_url":"https://github.com/chinpei215","followers_url":"https://api.github.com/users/chinpei215/followers","following_url":"https://api.github.com/users/chinpei215/following{/other_user}","gists_url":"https://api.github.com/users/chinpei215/gists{/gist_id}","starred_url":"https://api.github.com/users/chinpei215/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chinpei215/subscriptions","organizations_url":"https://api.github.com/users/chinpei215/orgs","repos_url":"https://api.github.com/users/chinpei215/repos","events_url":"https://api.github.com/users/chinpei215/events{/privacy}","received_events_url":"https://api.github.com/users/chinpei215/received_events","type":"User","site_admin":false},"repo":{"id":21547328,"node_id":"MDEwOlJlcG9zaXRvcnkyMTU0NzMyOA==","name":"cakephp","full_name":"chinpei215/cakephp","owner":{"login":"chinpei215","id":7399393,"node_id":"MDQ6VXNlcjczOTkzOTM=","avatar_url":"https://avatars2.githubusercontent.com/u/7399393?v=4","gravatar_id":"","url":"https://api.github.com/users/chinpei215","html_url":"https://github.com/chinpei215","followers_url":"https://api.github.com/users/chinpei215/followers","following_url":"https://api.github.com/users/chinpei215/following{/other_user}","gists_url":"https://api.github.com/users/chinpei215/gists{/gist_id}","starred_url":"https://api.github.com/users/chinpei215/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chinpei215/subscriptions","organizations_url":"https://api.github.com/users/chinpei215/orgs","repos_url":"https://api.github.com/users/chinpei215/repos","events_url":"https://api.github.com/users/chinpei215/events{/privacy}","received_events_url":"https://api.github.com/users/chinpei215/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/chinpei215/cakephp","description":"CakePHP: The Rapid Development Framework for PHP - Official Repository","fork":true,"url":"https://api.github.com/repos/chinpei215/cakephp","forks_url":"https://api.github.com/repos/chinpei215/cakephp/forks","keys_url":"https://api.github.com/repos/chinpei215/cakephp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chinpei215/cakephp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chinpei215/cakephp/teams","hooks_url":"https://api.github.com/repos/chinpei215/cakephp/hooks","issue_events_url":"https://api.github.com/repos/chinpei215/cakephp/issues/events{/number}","events_url":"https://api.github.com/repos/chinpei215/cakephp/events","assignees_url":"https://api.github.com/repos/chinpei215/cakephp/assignees{/user}","branches_url":"https://api.github.com/repos/chinpei215/cakephp/branches{/branch}","tags_url":"https://api.github.com/repos/chinpei215/cakephp/tags","blobs_url":"https://api.github.com/repos/chinpei215/cakephp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chinpei215/cakephp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chinpei215/cakephp/git/refs{/sha}","trees_url":"https://api.github.com/repos/chinpei215/cakephp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chinpei215/cakephp/statuses/{sha}","languages_url":"https://api.github.com/repos/chinpei215/cakephp/languages","stargazers_url":"https://api.github.com/repos/chinpei215/cakephp/stargazers","contributors_url":"https://api.github.com/repos/chinpei215/cakephp/contributors","subscribers_url":"https://api.github.com/repos/chinpei215/cakephp/subscribers","subscription_url":"https://api.github.com/repos/chinpei215/cakephp/subscription","commits_url":"https://api.github.com/repos/chinpei215/cakephp/commits{/sha}","git_commits_url":"https://api.github.com/repos/chinpei215/cakephp/git/commits{/sha}","comments_url":"https://api.github.com/repos/chinpei215/cakephp/comments{/number}","issue_comment_url":"https://api.github.com/repos/chinpei215/cakephp/issues/comments{/number}","contents_url":"https://api.github.com/repos/chinpei215/cakephp/contents/{+path}","compare_url":"https://api.github.com/repos/chinpei215/cakephp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chinpei215/cakephp/merges","archive_url":"https://api.github.com/repos/chinpei215/cakephp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chinpei215/cakephp/downloads","issues_url":"https://api.github.com/repos/chinpei215/cakephp/issues{/number}","pulls_url":"https://api.github.com/repos/chinpei215/cakephp/pulls{/number}","milestones_url":"https://api.github.com/repos/chinpei215/cakephp/milestones{/number}","notifications_url":"https://api.github.com/repos/chinpei215/cakephp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chinpei215/cakephp/labels{/name}","releases_url":"https://api.github.com/repos/chinpei215/cakephp/releases{/id}","deployments_url":"https://api.github.com/repos/chinpei215/cakephp/deployments","created_at":"2014-07-06T19:50:11Z","updated_at":"2014-07-08T17:25:16Z","pushed_at":"2018-08-21T01:47:38Z","git_url":"git://github.com/chinpei215/cakephp.git","ssh_url":"git@github.com:chinpei215/cakephp.git","clone_url":"https://github.com/chinpei215/cakephp.git","svn_url":"https://github.com/chinpei215/cakephp","homepage":"http://cakephp.org","size":76930,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"cakephp:master","ref":"master","sha":"2bc7e207df69605710e9cb38a02ae6fbeecb0773","user":{"login":"cakephp","id":23666,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIzNjY2","avatar_url":"https://avatars0.githubusercontent.com/u/23666?v=4","gravatar_id":"","url":"https://api.github.com/users/cakephp","html_url":"https://github.com/cakephp","followers_url":"https://api.github.com/users/cakephp/followers","following_url":"https://api.github.com/users/cakephp/following{/other_user}","gists_url":"https://api.github.com/users/cakephp/gists{/gist_id}","starred_url":"https://api.github.com/users/cakephp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cakephp/subscriptions","organizations_url":"https://api.github.com/users/cakephp/orgs","repos_url":"https://api.github.com/users/cakephp/repos","events_url":"https://api.github.com/users/cakephp/events{/privacy}","received_events_url":"https://api.github.com/users/cakephp/received_events","type":"Organization","site_admin":false},"repo":{"id":656494,"node_id":"MDEwOlJlcG9zaXRvcnk2NTY0OTQ=","name":"cakephp","full_name":"cakephp/cakephp","owner":{"login":"cakephp","id":23666,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIzNjY2","avatar_url":"https://avatars0.githubusercontent.com/u/23666?v=4","gravatar_id":"","url":"https://api.github.com/users/cakephp","html_url":"https://github.com/cakephp","followers_url":"https://api.github.com/users/cakephp/followers","following_url":"https://api.github.com/users/cakephp/following{/other_user}","gists_url":"https://api.github.com/users/cakephp/gists{/gist_id}","starred_url":"https://api.github.com/users/cakephp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cakephp/subscriptions","organizations_url":"https://api.github.com/users/cakephp/orgs","repos_url":"https://api.github.com/users/cakephp/repos","events_url":"https://api.github.com/users/cakephp/events{/privacy}","received_events_url":"https://api.github.com/users/cakephp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cakephp/cakephp","description":"CakePHP: The Rapid Development Framework for PHP - Official Repository","fork":false,"url":"https://api.github.com/repos/cakephp/cakephp","forks_url":"https://api.github.com/repos/cakephp/cakephp/forks","keys_url":"https://api.github.com/repos/cakephp/cakephp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cakephp/cakephp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cakephp/cakephp/teams","hooks_url":"https://api.github.com/repos/cakephp/cakephp/hooks","issue_events_url":"https://api.github.com/repos/cakephp/cakephp/issues/events{/number}","events_url":"https://api.github.com/repos/cakephp/cakephp/events","assignees_url":"https://api.github.com/repos/cakephp/cakephp/assignees{/user}","branches_url":"https://api.github.com/repos/cakephp/cakephp/branches{/branch}","tags_url":"https://api.github.com/repos/cakephp/cakephp/tags","blobs_url":"https://api.github.com/repos/cakephp/cakephp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cakephp/cakephp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cakephp/cakephp/git/refs{/sha}","trees_url":"https://api.github.com/repos/cakephp/cakephp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cakephp/cakephp/statuses/{sha}","languages_url":"https://api.github.com/repos/cakephp/cakephp/languages","stargazers_url":"https://api.github.com/repos/cakephp/cakephp/stargazers","contributors_url":"https://api.github.com/repos/cakephp/cakephp/contributors","subscribers_url":"https://api.github.com/repos/cakephp/cakephp/subscribers","subscription_url":"https://api.github.com/repos/cakephp/cakephp/subscription","commits_url":"https://api.github.com/repos/cakephp/cakephp/commits{/sha}","git_commits_url":"https://api.github.com/repos/cakephp/cakephp/git/commits{/sha}","comments_url":"https://api.github.com/repos/cakephp/cakephp/comments{/number}","issue_comment_url":"https://api.github.com/repos/cakephp/cakephp/issues/comments{/number}","contents_url":"https://api.github.com/repos/cakephp/cakephp/contents/{+path}","compare_url":"https://api.github.com/repos/cakephp/cakephp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cakephp/cakephp/merges","archive_url":"https://api.github.com/repos/cakephp/cakephp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cakephp/cakephp/downloads","issues_url":"https://api.github.com/repos/cakephp/cakephp/issues{/number}","pulls_url":"https://api.github.com/repos/cakephp/cakephp/pulls{/number}","milestones_url":"https://api.github.com/repos/cakephp/cakephp/milestones{/number}","notifications_url":"https://api.github.com/repos/cakephp/cakephp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cakephp/cakephp/labels{/name}","releases_url":"https://api.github.com/repos/cakephp/cakephp/releases{/id}","deployments_url":"https://api.github.com/repos/cakephp/cakephp/deployments","created_at":"2010-05-08T14:38:22Z","updated_at":"2018-08-20T15:43:53Z","pushed_at":"2018-08-21T01:47:41Z","git_url":"git://github.com/cakephp/cakephp.git","ssh_url":"git@github.com:cakephp/cakephp.git","clone_url":"https://github.com/cakephp/cakephp.git","svn_url":"https://github.com/cakephp/cakephp","homepage":"http://cakephp.org","size":80248,"stargazers_count":7610,"watchers_count":7610,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":3343,"mirror_url":null,"archived":false,"open_issues_count":247,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":3343,"open_issues":247,"watchers":7610,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cakephp/cakephp/pulls/12486"},"html":{"href":"https://github.com/cakephp/cakephp/pull/12486"},"issue":{"href":"https://api.github.com/repos/cakephp/cakephp/issues/12486"},"comments":{"href":"https://api.github.com/repos/cakephp/cakephp/issues/12486/comments"},"review_comments":{"href":"https://api.github.com/repos/cakephp/cakephp/pulls/12486/comments"},"review_comment":{"href":"https://api.github.com/repos/cakephp/cakephp/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cakephp/cakephp/pulls/12486/commits"},"statuses":{"href":"https://api.github.com/repos/cakephp/cakephp/statuses/ba2f4d9eea1b3622b195126ecdbce2b057d4896d"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"chinpei215"}}