diff --git a/cake/libs/validation.php b/cake/libs/validation.php index 73a90fe33..c6fde1e76 100644 --- a/cake/libs/validation.php +++ b/cake/libs/validation.php @@ -782,11 +782,13 @@ class Validation extends Object { $_this->regex = '/\\A\\b[0-9]{9}\\b\\z/i'; break; case 'us': - default: $_this->regex = '/\\A\\b[0-9]{3}-[0-9]{2}-[0-9]{4}\\b\\z/i'; break; } } + if (empty($_this->regex)) { + return $_this->_pass('ssn', $check, $country); + } return $_this->_check(); } diff --git a/cake/tests/cases/libs/validation.test.php b/cake/tests/cases/libs/validation.test.php index 5e76b9b76..f1af0ce8b 100644 --- a/cake/tests/cases/libs/validation.test.php +++ b/cake/tests/cases/libs/validation.test.php @@ -58,10 +58,18 @@ class TestNlValidation { function postal($check) { return true; } +/** + * ssn function for testing ssn pass through + * + * @return void + */ + function ssn($check) { + return true; + } } /** - * TestNlValidation class + * TestDeValidation class * * Used to test pass through of Validation * @@ -2041,9 +2049,10 @@ class ValidationTest extends CakeTestCase { * * @return void */ - function testPhoneAndPostalPass() { + function testPhonePostalSsnPass() { $this->assertTrue(Validation::postal('text', null, 'testNl')); $this->assertTrue(Validation::phone('text', null, 'testDe')); + $this->assertTrue(Validation::ssn('text', null, 'testNl')); } /**