Skip to content

Commit

Permalink
Improvement to Validator::uuid
Browse files Browse the repository at this point in the history
Properly matches version digit and variant digit, based on RFC4122
  • Loading branch information
tenebrousedge committed Mar 15, 2013
1 parent 58de670 commit 99c41e0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Cake/Utility/Validation.php
Expand Up @@ -776,7 +776,7 @@ public static function userDefined($check, $object, $method, $args = null) {
* @return boolean Success
*/
public static function uuid($check) {
$regex = '/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i';
$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}$/';
return self::_check($check, $regex);
}

Expand Down

0 comments on commit 99c41e0

Please sign in to comment.