giggsey / libphonenumber-for-php

PHP version of Google's phone number handling library
https://giggsey.com/libphonenumber/
Apache License 2.0
4.76k stars 468 forks source link

brazilian cellphone number is not correctly validated #640

Closed mzramna closed 3 months ago

mzramna commented 3 months ago

the regular expression to validate the official cellphone numbers in brazil is: "/^([3-9]\d)([9][1-5]\d{7})$|^([3-9]\d)[9]?(\d{8})$|^([1-2]\d)(\d{9})$/" the phonenumbers without the 9 digit is not being accepted by the library, if the phone has an ddd started by 2 or 1 it is obligated to has the 9 digit, but if is not, it is not obligatory in the non obligatory cases the 9 digit has to be added to be validated by the lib, it could be done automaticaly

giggsey commented 3 months ago

Hi,

Please check the FAQ for checking with invalid numbers.

You'll need to check the number using Google's Demo, then report the issue to them if the number still shows as invalid.