Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Fix Brazil PhoneNumber Regexp #103

Merged
merged 3 commits into from Sep 25, 2019
Merged

Conversation

rwrz
Copy link
Contributor

@rwrz rwrz commented Aug 30, 2018

For some reason, all REGEX was using \\d instead of \d... this should fix the problem.
And Brazilian numbers changed mobile numbers to begin with an 9 before the area code... fixed this regex too.

  • Are you fixing a bug?

  • Detail how the bug is invoked currently.
    Currently, any BR number should work, because of a typo on REGEX. \\d instead of \d.
    Someone should verify all others files, since it is a typo...

  • Detail the original, incorrect behavior.
    There is a problem with BR mobile numbers too. Now, all brazilian mobile numbers starts with a 9.

  • Detail the new, expected behavior.
    Fixed to accept the 9.

  • Add a CHANGELOG.md entry for the fix.
    Sorry, can someone do that? I'm changing here in Github...

  • Provide a test case
    Sorry, can someone do that? I'm changing here in Github...

@froschdesign
Copy link
Member

All unit tests are successful - with and without these changes?!

Copy link
Member

@Ocramius Ocramius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requires addition of example phone numbers in the test suite

@froschdesign froschdesign added this to the 2.9.1 milestone Sep 19, 2019
Brazilian mobile numbers begin with an 9 before the area code.
All brazilian mobile numbers have digit 9 after area code (two first digits)
then number 6-9 and another 7 digits.
@michalbundyra
Copy link
Member

@rwrz Would you be able to review my changes?
\\ doesn't matter in all of these regular expression as in PHP \\ is the same as \ and it's fine. All other files are also using \\ so I revert that change for consistency.

I've updated area code for fixed and mobile phones and added 9 after area code for mobiles.
It looks like mobile phones must have 11 digits in total.

@michalbundyra michalbundyra changed the title Fix BR Regex Fix Brazil PhoneNumber Regexp Sep 22, 2019
@rwrz
Copy link
Contributor Author

rwrz commented Sep 23, 2019

@webimpress all good man, tested with a few real numbers... working 100%.

michalbundyra added a commit that referenced this pull request Sep 25, 2019
Fix Brazil PhoneNumber Regexp

# Conflicts:
#	src/Validator/PhoneNumber/BR.php
michalbundyra added a commit that referenced this pull request Sep 25, 2019
@michalbundyra michalbundyra merged commit 98afa46 into zendframework:master Sep 25, 2019
michalbundyra added a commit that referenced this pull request Sep 25, 2019
@michalbundyra
Copy link
Member

Thanks, @rwrz!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants