Permalink
Browse files

Improvement to Validator::uuid

Properly matches version digit and variant digit, based on RFC4122
  • Loading branch information...
1 parent 58de670 commit 99c41e0af4d864c5a13a46659f52f9db90b97ad0 @tenebrousedge tenebrousedge committed Mar 15, 2013
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/Cake/Utility/Validation.php
@@ -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);
}

0 comments on commit 99c41e0

Please sign in to comment.