Skip to content
This repository has been archived by the owner on Jun 10, 2018. It is now read-only.

Stricter phone number format matching #52

Closed
wants to merge 2 commits into from
Closed

Stricter phone number format matching #52

wants to merge 2 commits into from

Conversation

deuxpi
Copy link

@deuxpi deuxpi commented Aug 8, 2017

The libphonenumber project has deprecated and removed possibleNumberPattern from the metadata file and this causes the database generator to fail.

Announcement in April 2017: https://groups.google.com/forum/#!msg/libphonenumber-discuss/75TOpTFVi08/wobxkrstBAAJ
Change in libphonenumber: google/libphonenumber#1704

This PR changes the behaviour of the GlobalPhone::Territory class to consider a phone number as possible if the length of the string matches the number of digits of any national or local-only formats. This should align this gem on what libphonenumber currently does.

This change created a major regression where a lot of strings would then be considered valid national phone numbers. To prevent this, a solution similar to what is found in #2 has been implemented, allowing d25c34b to be reverted.

Should fix #51 and possibly others.

Example phone numbers and database test fixtures have been regenerated from current libphonenumber master metadata.

@deuxpi
Copy link
Author

deuxpi commented Aug 9, 2017

👋 @eileencodes I can probably get people from our organization to review the changes. How do you want to proceed with integrating changes in this library?

This particular PR is intrusive and would make the databases on currently installed systems to become obsolete, so it can be considered a major and breaking change. Still I think keeping up with current releases of libphonenumber is a good long term goal.

Philippe Gauthier added 2 commits December 21, 2017 16:43
Google announced[1] in August 2016 then in April 2017 that the
PossibleNumberPattern elements where deprecated. GlobalPhone still
relies on those elements and as such cannot use recent releases of
the libphonenumber metadata.

This PR replaces the usage of PossibleNumberPattern with a new parser
design that matches more closely what libphonenumber does. Simple
territory matching is now done by using PossibleLengths elements and
then all the NationalNumberPattern for valid territories are compared.

[1] https://groups.google.com/forum/#!msg/libphonenumber-discuss/75TOpTFVi08/wobxkrstBAAJ
@deuxpi deuxpi closed this May 30, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Latest PhoneNumberMetadata.xml is no longer compatible with global_phone
1 participant