php-src/Zend/tests/array_hash_zero.phpt
Bob Weinand dac2b060e4 Remove bogus ZEND_ASSERT(hash != 0)
There's always a possibility that the has will end up as equal to zero due to overflowing.
See the tests for strings whose hash overflow.
Yes, there's a check for whether the hash already was calculated... and strings with a hash equal to zero always need the hash recalculated, in one of 2^32 respectively 2^64 cases - which should not be a major issue.
2015-03-18 22:25:55 +01:00

21 lines
310 B
PHP

--TEST--
Accept hashes being equal to zero
--FILE--
<?php
$hashes = [
"\x8e\x1a\x63\x0f\x61" => 32,
"\xf7\x17\x7f\x7f\x7f\x7f\x7f\x7f\x7f\x6b\x03\x6a\x13\x63\x17\x6b\x1d\x67" => 64,
];
foreach ($hashes as $hash => $bits) {
var_dump($hashes[$hash], $bits);
}
?>
--EXPECT--
int(32)
int(32)
int(64)
int(64)