diff --git a/lib/Cake/Utility/Security.php b/lib/Cake/Utility/Security.php index 464d05f71..be128e64a 100644 --- a/lib/Cake/Utility/Security.php +++ b/lib/Cake/Utility/Security.php @@ -191,8 +191,10 @@ class Security { E_USER_WARNING ); $bytes = ''; - while (strlen($bytes) < $length) { + $byteLength = 0; + while ($byteLength < $length) { $bytes .= static::hash(CakeText::uuid() . uniqid(mt_rand(), true), 'sha512', true); + $byteLength = strlen($bytes); } return substr($bytes, 0, $length); }