zendframework/zend-i18n

Phonenumber validator out-of-date

coolmic opened this issue · 0 comments

I am using Phonenumber validator to check is the given mobile phonenumber is correct.

Someone in Luxembourg tried to add his phonenumber, but the validator doesn't allow him to do.
His phonenumber is (+352) 67X XXX XXX

In the config file https://github.com/zendframework/zend-i18n/blob/master/src/Validator/PhoneNumber/LU.php#L16 , the accepted pattern is /^6[269][18]\\d{6}$/.

It seems this file was generated from the now expired http://libphonenumber.googlecode.com/svn/trunk/resources/PhoneNumberMetaData.xml , the replacement is https://github.com/googlei18n/libphonenumber .
The new pattern is 6[2679][18]\\d{6}.

I thought about doing a pull request just for LU.php, but there is outdated pattern for a lot of countries (see https://github.com/googlei18n/libphonenumber/commits/master/javascript/i18n/phonenumbers/metadatalite.js ), there is new updates every two weeks.

I think we should do something about this.

Either we do a script to scrap googlei18n/libphonenumber to regenerate phonenumber files , or we use an external library (like https://github.com/giggsey/libphonenumber-for-php , it scraps googlei18n/libphonenumber too ).