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
Changes from 1 commit
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})$/',
Copy link
Contributor

Choose a reason for hiding this comment

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

You can make it a non-matching group and save memory:

'/^(?:[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