Skip to content

Saudi Arabia (SA) mobile numbers starting with 052x and 057x are incorrectly rejected. #2678

@habeebFayez

Description

@habeebFayez

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: needs triageIssues which needs to be reproduced to be verified report.type: fixIssues describing a broken feature.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions