Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Fix pattern for mobile phone number #6161

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion library/Zend/I18n/Validator/PhoneNumber/FR.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
'national' => array(
'general' => '/^[124-9]\\d{8}|3\\d{3}(?:\\d{5})?$/',
'fixed' => '/^[1-5]\\d{8}$/',
'mobile' => '/^[6-7]\\d{8}|7[5-9]\\d{7}$/',
'mobile' => '/^(?:[6-7]\\d{8}|7[5-9]\\d{7})$/',
'tollfree' => '/^80\\d{7}$/',
'premium' => '/^3\\d{3}|89[1-37-9]\\d{6}$/',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know what is a premium number, but the regex may have the same issue.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some failing cases in tests would have detected the problem.

'shared' => '/^8(?:1[019]|2[0156]|84|90)\\d{6}$/',
Expand Down
2 changes: 1 addition & 1 deletion tests/ZendTest/I18n/Validator/PhoneNumberTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,7 @@ class PhoneNumberTest extends \PHPUnit_Framework_TestCase
'patterns' => array(
'example' => array(
'fixed' => '123456789',
'mobile' => '612345678',
'mobile' => array('612345678', '712345678',),
'tollfree' => '801234567',
'premium' => '891123456',
'shared' => '810123456',
Expand Down