hash_equals(): Avoid division by zero when $known_string is empty
authorKevin Israel <pleasestand@live.com>
Tue, 24 Jun 2014 05:33:46 +0000 (01:33 -0400)
committerTim Starling <tstarling@wikimedia.org>
Tue, 7 Oct 2014 06:42:12 +0000 (06:42 +0000)
commit4620e3b862568d76661e86857779795f4f974e13
treeb7cc0d4d27580e9c18845257084fa33bdf580ebe
parent9f0d40e08f1b8b562d89457a6c1a0eb5dbfa7828
hash_equals(): Avoid division by zero when $known_string is empty

Per Tim Starling's review of Icb239471, reverted back to the version of
the function from Patch Set 1 of Iece006ec, which did not have the bug.
This version does not attempt to minimize the inevitable leakage of the
string's length.

Also revised the doc comment to explain more effectively what the problem
with a normal (===) string comparison is for the use cases of this function.

Follows-up b9e1d5f5c066.

Change-Id: I1b347e69b39af3d7d8ba6673af63f1a616befbdf
includes/GlobalFunctions.php