Skip to content

Commit

Permalink
correct and unify country codes for validation
Browse files Browse the repository at this point in the history
  • Loading branch information
euromark committed Mar 23, 2013
1 parent c3222f7 commit 47f388a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Cake/Utility/Validation.php
Expand Up @@ -617,8 +617,8 @@ public static function phone($check, $regex = null, $country = 'all') {
if (is_null($regex)) {
switch ($country) {
case 'us':
case 'ca':
case 'all':
case 'can':
// includes all NANPA members.
// 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}$/';
Expand Down

0 comments on commit 47f388a

Please sign in to comment.