Skip to content

Commit 45f41a4

Browse files
committed
Make Redis Array tests work on 32-bit.
The custom key distribution function was returning negative ring offsets. This fix makes sure we always return positive or zero.
1 parent b15e78b commit 45f41a4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tests/array-tests.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ public function testKeyLocality() {
9595

9696
public function customDistributor($key)
9797
{
98-
$a = unpack("N*", md5($key, true));;
98+
$a = unpack("N*", md5($key, true));
9999
global $newRing;
100-
$pos = $a[1] % count($newRing);
100+
$pos = abs($a[1]) % count($newRing);
101101

102102
return $pos;
103103
}

0 commit comments

Comments
 (0)