Description
Saudi Arabia (SA) mobile numbers starting with 052x and 057x (some work and some doesn't) are incorrectly rejected by isValidNumber() and return UNKNOWN from getNumberType().
code-snippet showcasing the problem
PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance();
PhoneNumber number = phoneUtil.parse("0529339xxx", "SA");
System.out.println(phoneUtil.isValidNumber(number)); // false — expected true
System.out.println(phoneUtil.getNumberType(number)); // UNKNOWN — expected MOBILE
PhoneNumber number2 = phoneUtil.parse("0579339xxx", "SA");
System.out.println(phoneUtil.isValidNumber(number2)); // false — expected true
System.out.println(phoneUtil.getNumberType(number2)); // UNKNOWN — expected MOBILE
Expected behavior
isValidNumber() returns true and getNumberType() returns MOBILE for valid SA mobile numbers starting with 052x and 057x, as these are active numbers assigned by Saudi telecom operators.
Actual behavior
isValidNumber() returns false and getNumberType() returns UNKNOWN, causing these numbers to fail validation entirely. Numbers starting with 059x work correctly, suggesting the mobile regex pattern in the SA metadata is missing certain 05x ranges.
Library version: 8.13.x (latest)
Region: SA (Saudi Arabia, +966)
Note : also for phoneUtil.parse(phoneNo, "" ); this will not parse the number as expected but still can work around it to pass the regionCode by user request
Description
Saudi Arabia(SA) mobile numbers starting with052xand057x(some work and some doesn't) are incorrectly rejected byisValidNumber()and returnUNKNOWNfrom getNumberType().code-snippet showcasing the problem
Expected behavior
isValidNumber()returns true andgetNumberType()returnsMOBILEfor valid SA mobile numbers starting with052xand057x, as these are active numbers assigned by Saudi telecom operators.Actual behavior
isValidNumber()returns false andgetNumberType()returnsUNKNOWN, causing these numbers to fail validation entirely. Numbers starting with 059x work correctly, suggesting the mobile regex pattern in the SA metadata is missing certain 05x ranges.Library version: 8.13.x (latest)
Region: SA (Saudi Arabia, +966)
Note : also for
phoneUtil.parse(phoneNo, "" );this will not parse the number as expected but still can work around it to pass the regionCode by user request