Permalink
Browse files

Update UUID pattern to accept the 'nil' UUID.

Fixes #4133
  • Loading branch information...
markstory committed Oct 11, 2013
1 parent 04eae1f commit 5aa8a458b16125fe53004b2785e51a3515f75b6b
Showing with 2 additions and 1 deletion.
  1. +1 −0 lib/Cake/Test/Case/Utility/ValidationTest.php
  2. +1 −1 lib/Cake/Utility/Validation.php
@@ -1924,6 +1924,7 @@ public function testUrl() {
}
public function testUuid() {
+ $this->assertTrue(Validation::uuid('00000000-0000-0000-0000-000000000000'));
$this->assertTrue(Validation::uuid('550e8400-e29b-11d4-a716-446655440000'));
$this->assertFalse(Validation::uuid('BRAP-e29b-11d4-a716-446655440000'));
$this->assertTrue(Validation::uuid('550E8400-e29b-11D4-A716-446655440000'));
@@ -797,7 +797,7 @@ public static function userDefined($check, $object, $method, $args = null) {
* @return boolean Success
*/
public static function uuid($check) {
- $regex = '/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89aAbB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$/';
+ $regex = '/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[0-5][a-fA-F0-9]{3}-[089aAbB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$/';
return self::_check($check, $regex);
}

0 comments on commit 5aa8a45

Please sign in to comment.