Fix: The isMobilePhone validator incorrectly rejects valid Uzbeki#2705
Closed
Sagar-024 wants to merge 1 commit into
Closed
Fix: The isMobilePhone validator incorrectly rejects valid Uzbeki#2705Sagar-024 wants to merge 1 commit into
Sagar-024 wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2705 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 114 114
Lines 2587 2587
Branches 656 656
=========================================
Hits 2587 2587 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root Cause Analysis
The bug is in the phone number validation regex for Uzbekistan's locale. Uzbekistan mobile numbers starting with +998 typically use prefixes like 90, 91, 93, 94, 95, 97, 98, 99, but the 77 prefix was later added for new number ranges. The current regex pattern doesn't include '77' as a valid carrier code, causing valid numbers like +998771234567 to be incorrectly rejected. The fix would involve updating the regex pattern for the 'uz-UZ' locale in the isMobilePhone source code to include the 77 prefix alongside existing ones.
Proof of Bug
The following reproduction test was executed in a sandboxed environment and failed as expected, confirming the reported issue:
The Fix
Applied surgical code changes to address the root cause.
Proof of Fix
After applying the surgical patch, the reproduction test and the project's test suite were executed. All tests passed successfully:
Generated by Repatch — Autonomous Test-Driven Debugging