ttacon / libphonenumber

golang port of Google's libphonenumber
MIT License
618 stars 105 forks source link

Parse() not throwing error when expected #114

Open david-dietz opened 2 years ago

david-dietz commented 2 years ago

When parsing out a String using libphonenumber.Parse() or libphonenumber.ParseAndKeepRawInput(), there are certain values that I would expect NumberParseException to be thrown, but instead the input is parsed "successfully" into a *PhoneNumber. Here are some examples:

Example 1

 number, err := libphonenumber.Parse("123@gmail.com", "US")

Results in:

 number.CountryCode = 1
 number.NationalNumber = 2346245266

Example 2

 number, err := libphonenumber.Parse("email.133@gmail.com", "US")

Results in:

 number.CountryCode = 1
 number.NationalNumber = 3346245266

Example 3

 number, err := libphonenumber.Parse("HEB17143428716", "US)

Results in

 number.CountryCode = 1
 number.NationalNumber = 7143428716