You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some phone numbers generated by Faker.Phone.PhoneNumber() when using the en_GB locale are invalid
LINQPad Example or Reproduction Steps
Bogus 35.6.0
libphonenumber-csharp 8.13.43
usingBogus;usingPhoneNumbers;voidMain(){while(true){varfaker=newFaker("en_GB");stringphoneNumber=faker.Phone.PhoneNumber();PhoneNumberUtil?phoneNumberUtil=PhoneNumberUtil.GetInstance();PhoneNumbers.PhoneNumber?parsedPhoneNumber=phoneNumberUtil.Parse(phoneNumber,"GB");if(!phoneNumberUtil.IsValidNumberForRegion(parsedPhoneNumber,"GB")){thrownewException("Invalid phone number "+phoneNumber);}}}
Expected Behavior
All UK phone numbers generated by faker.Phone.PhoneNumber(); should be valid.
Bogus NuGet Package
35.6.0
.NET Version
NET 8.0.400
Visual Studio Version
Rider 2024.1.4
What operating system are you using?
Windows
What locale are you using with Bogus?
en_GB
Problem Description
Some phone numbers generated by Faker.Phone.PhoneNumber() when using the en_GB locale are invalid
LINQPad Example or Reproduction Steps
Expected Behavior
All UK phone numbers generated by
faker.Phone.PhoneNumber();
should be valid.See Google's libPhoneNumber: https://github.com/google/libphonenumber/blob/master/resources/PhoneNumberMetadata.xml#L11093
Actual Behavior
faker.Phone.PhoneNumber();
sometimes generates invalid UK phone numbers, such as:Known Workarounds
Faker.Phone.PhoneNumber("07#########")
is a suitable workaround.Could you help with a pull-request?
No
The text was updated successfully, but these errors were encountered: