mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 17:16:18 +00:00
Merge pull request #1191 from dereuromark/2.4-validation
correct and unify country codes for validation
This commit is contained in:
commit
75fd460f2a
1 changed files with 3 additions and 1 deletions
|
@ -617,8 +617,10 @@ class Validation {
|
||||||
if (is_null($regex)) {
|
if (is_null($regex)) {
|
||||||
switch ($country) {
|
switch ($country) {
|
||||||
case 'us':
|
case 'us':
|
||||||
case 'all':
|
case 'ca':
|
||||||
|
// deprecated three-letter-code
|
||||||
case 'can':
|
case 'can':
|
||||||
|
case 'all':
|
||||||
// includes all NANPA members.
|
// includes all NANPA members.
|
||||||
// see http://en.wikipedia.org/wiki/North_American_Numbering_Plan#List_of_NANPA_countries_and_territories
|
// see http://en.wikipedia.org/wiki/North_American_Numbering_Plan#List_of_NANPA_countries_and_territories
|
||||||
$regex = '/^(?:\+?1)?[-. ]?\\(?[2-9][0-8][0-9]\\)?[-. ]?[2-9][0-9]{2}[-. ]?[0-9]{4}$/';
|
$regex = '/^(?:\+?1)?[-. ]?\\(?[2-9][0-8][0-9]\\)?[-. ]?[2-9][0-9]{2}[-. ]?[0-9]{4}$/';
|
||||||
|
|
Loading…
Add table
Reference in a new issue