{"action":"closed","issue":{"url":"https://api.github.com/repos/commerceguys/addressing/issues/91","repository_url":"https://api.github.com/repos/commerceguys/addressing","labels_url":"https://api.github.com/repos/commerceguys/addressing/issues/91/labels{/name}","comments_url":"https://api.github.com/repos/commerceguys/addressing/issues/91/comments","events_url":"https://api.github.com/repos/commerceguys/addressing/issues/91/events","html_url":"https://github.com/commerceguys/addressing/issues/91","id":260251833,"number":91,"title":"Postal code regex for Bahrain (BH) is wrong","user":{"login":"tinnerdxp","id":1458530,"avatar_url":"https://avatars2.githubusercontent.com/u/1458530?v=4","gravatar_id":"","url":"https://api.github.com/users/tinnerdxp","html_url":"https://github.com/tinnerdxp","followers_url":"https://api.github.com/users/tinnerdxp/followers","following_url":"https://api.github.com/users/tinnerdxp/following{/other_user}","gists_url":"https://api.github.com/users/tinnerdxp/gists{/gist_id}","starred_url":"https://api.github.com/users/tinnerdxp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tinnerdxp/subscriptions","organizations_url":"https://api.github.com/users/tinnerdxp/orgs","repos_url":"https://api.github.com/users/tinnerdxp/repos","events_url":"https://api.github.com/users/tinnerdxp/events{/privacy}","received_events_url":"https://api.github.com/users/tinnerdxp/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-09-25T12:07:30Z","updated_at":"2018-04-26T14:07:34Z","closed_at":"2018-04-26T14:07:33Z","author_association":"NONE","body":"Postal codes in Bahrain also known as \"Block numbers\", are usually 4 digits, however the regex tries to match against 3 characters first, causing the check:\r\n```\r\n            preg_match('/' . $fullPattern . '/i', $postalCode, $matches);\r\n            if (!isset($matches[0]) || $matches[0] != $postalCode) {\r\n                $this->addViolation(AddressField::POSTAL_CODE, $constraint->invalidMessage, $postalCode, $addressFormat);\r\n\r\n                return;\r\n            }\r\n```\r\nto trigger the addViolation() call\r\nthe regex should be changed to something allowing more explicit matching, example:\r\n^(?:1[0-2]|\\d)\\d{2}$"}}
{"actor":{"display_login":"bojanz"}}