Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extension-free US phone numbers #18

Closed
MGatner opened this issue Oct 27, 2020 · 10 comments · Fixed by #91
Closed

Extension-free US phone numbers #18

MGatner opened this issue Oct 27, 2020 · 10 comments · Fixed by #91
Labels
bug Something isn't working

Comments

@MGatner
Copy link

MGatner commented Oct 27, 2020

Summary

Porting this issue because it still matters to me... The current phone number generators have the possibility of producing results considered invalid by Google Firebase and Stripe, among others. This is due mostly to random extensions on Faker\Provider\en_US\PhoneNumber which either cause the number to be too long or invalidate it because of the "x" character.

Please consider breaking phone numbers out (like streetName, streetSuffix, and streetAddress) and/or supporting a PhoneNumberSimple generator.

fzaninotto#1909

Versions

Version
PHP 7.4
fakerphp/faker 1.9
@pimjansen
Copy link

pimjansen commented Oct 28, 2020

Do you have some more info on what is invalid there and what you expect?

Please ensure the bugreport is valid as mentioned in the template

@pimjansen pimjansen added the invalid This doesn't seem right label Oct 28, 2020
@hopeseekr
Copy link

I have had to add regex to strip out the “x5555” from Faker phone numbers just so my tests won’t break.

@pimjansen pimjansen added bug Something isn't working and removed invalid This doesn't seem right labels Nov 5, 2020
@pimjansen
Copy link

@hopeseekr do we even know where the X is for? Looking at the wiki i dont see it existing in any spec.

However im not from the regionso for me it is hard to tell

@MGatner
Copy link
Author

MGatner commented Nov 5, 2020

@pimjansen it indicates an extension, usually not dialed with the phone number but after connecting to a main relay. They are not uncommon but individuals would never have extensions, it is an indicator of a business number.

@pimjansen
Copy link

@pimjansen it indicates an extension, usually not dialed with the phone number but after connecting to a main relay. They are not uncommon but individuals would never have extensions, it is an indicator of a business number.

So therefor they are valid?

@MGatner
Copy link
Author

MGatner commented Nov 5, 2020

That depends on who you ask! The reason I opened this issue is that they aren't considered valid by Stripe or Firebase (probably among others). They are never valid programmatically, as in you cannot dial them. However people in the USA would understand what they meant and how to use them, and you may not be able to reach the desired person without the extra info.

@MGatner
Copy link
Author

MGatner commented Nov 5, 2020

In my opinion the appropriate way to handle these should have been to have extension be a separate endpoint. I'm not sure if changing it now would be considered BC

@pimjansen
Copy link

Well imo a phonenumber is reachable by a phone. Meaning that if it is a number that you can not dial it is not ok and should not be in the output.

To keep it simple we ofcourse want to create these numbers at any point. Therefor i think it is best to add a method to generate the numbers that are now considered wrong and update the existing one.

Will that work?

@MGatner
Copy link
Author

MGatner commented Nov 5, 2020

Absolutely! That would be awesome. So to be clear, this would be something like:

  • Add phoneNumberWithExtension // '201-886-0269 x3767'
  • Adjust existing phoneNumber // '919-824-1234'

@pimjansen
Copy link

Absolutely! That would be awesome. So to be clear, this would be something like:

  • Add phoneNumberWithExtension // '201-886-0269 x3767'
  • Adjust existing phoneNumber // '919-824-1234'

Yes would work for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants