Merge pull request #290 from sarciszewski/patch-1

Remove side-effects in hash_equals()
This commit is contained in:
Alex Bilbie 2015-01-01 12:52:03 +00:00
commit 19b64c2e65

View File

@ -128,9 +128,9 @@ class MAC extends AbstractTokenType implements TokenTypeInterface
*/ */
private function hash_equals($knownString, $userString) private function hash_equals($knownString, $userString)
{ {
if (!function_exists('hash_equals')) { if (function_exists('\hash_equals')) {
function hash_equals($knownString, $userString) return \hash_equals($knownString, $userString);
{ }
if (strlen($knownString) !== strlen($userString)) { if (strlen($knownString) !== strlen($userString)) {
return false; return false;
} }
@ -143,7 +143,3 @@ class MAC extends AbstractTokenType implements TokenTypeInterface
return 0 === $result; return 0 === $result;
} }
} }
return hash_equals($knownString, $userString);
}
}