Faker icon indicating copy to clipboard operation
Faker copied to clipboard

French phone numbers invalid for libphonenumber

Open williamdes opened this issue 6 years ago • 6 comments

Summary

Ref: https://github.com/giggsey/libphonenumber-for-php/issues/352

Faker generates french phone numbers like +33 (0)4 06 21 24 41 that are not considered valid for https://libphonenumber.appspot.com/phonenumberparser?number=%2B33+%280%294+06+21+24+41&country=FR (https://github.com/giggsey/libphonenumber-for-php/issues/352#issuecomment-564572213)

Versions

Version
PHP 7.2.24
fzaninotto/faker 1.9.1

Self-enclosed code snippet for reproduction

$faker->phoneNumber()

Expected output

https://libphonenumber.appspot.com/phonenumberparser?number=+33%20(0)4%2010%2021%2024%2041&country=FR https://www.frameip.com/plan-numerotation-telephonique/ https://telecommunications.monsite-orange.fr/page-559951e5d006c.html image image

+33 4 10 21 24 41

Actual output

+33 (0)4 06 21 24 41

If their an option to have libphonenumber/google valid phone numbers ?

williamdes avatar Dec 12 '19 13:12 williamdes

@fzaninotto maybe Faker can not do nothing for this issue ?

williamdes avatar Dec 12 '19 13:12 williamdes

@fzaninotto I added some links and pictures

williamdes avatar Dec 12 '19 15:12 williamdes

Thanks. Indeed, the French PhoneNumber provider could be improved to generate only valid numbers. Would you like to work on a patch?

fzaninotto avatar Dec 17 '19 08:12 fzaninotto

@fzaninotto If you have time you can patch the issue, I think I will have time in ~1-2 weeks

williamdes avatar Dec 17 '19 10:12 williamdes

@fzaninotto if you want to fix it then go ahead, I am not having the time needed for this issue soon

williamdes avatar Feb 18 '20 07:02 williamdes

I checked this issue and fixed it changing this file : Faker/src/Faker/Provider/fr_FR/PhoneNumber.php faker

The result looks ok and the tests also passed.

jonatanbzk avatar Mar 27 '20 08:03 jonatanbzk