Commit 8802d030 by Alexander Makarov

Avoid method call in for condition

parent 07f01bcf
......@@ -497,7 +497,7 @@ class Security extends Component
{
// timing attack resistant approach:
$diff = 0;
for ($i = 0; $i < StringHelper::byteLength($actual); $i++) {
for ($i = 0, $length = StringHelper::byteLength($actual); $i < $length; $i++) {
$diff |= (ord($actual[$i]) ^ ord($expected[$i]));
}
return $diff === 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment