Skip to content

Commit

Permalink
Use strlen(). Comparing a string against a length will not do the rig…
Browse files Browse the repository at this point in the history
…ht thing.
  • Loading branch information
markstory committed May 3, 2016
1 parent 8cd5a64 commit b6d631b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Cake/Utility/Security.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public static function randomBytes($length) {
E_USER_WARNING
);
$bytes = '';
while ($bytes < $length) {
while (strlen($bytes) < $length) {
$bytes .= static::hash(CakeText::uuid() . uniqid(mt_rand(), true), 'sha512', true);
}
return substr($bytes, 0, $length);
Expand Down

0 comments on commit b6d631b

Please sign in to comment.