From 8a228d77177d36aac314e8fdae5c6dbc127768c6 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Sat, 27 Sep 2008 23:36:21 +0000 Subject: [PATCH] Avoid strange negative bucket key values in certain situations (bug 12342) --- includes/memcached-client.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/includes/memcached-client.php b/includes/memcached-client.php index cf98bb9daf..0640adf211 100644 --- a/includes/memcached-client.php +++ b/includes/memcached-client.php @@ -795,11 +795,6 @@ class memcached $realkey = is_array($key) ? $key[1] : $key; for ($tries = 0; $tries<20; $tries++) { - // temp logging for strange bug - if( !isset($this->_buckets[$hv % $this->_bucketcount]) ) { - wfDebugLog( "memcached", "Invalid bucket hash '$hv' from key '$realkey' given!" ); - continue; - } $host = $this->_buckets[$hv % $this->_bucketcount]; $sock = $this->sock_to_host($host); if (is_resource($sock)) { @@ -807,6 +802,7 @@ class memcached return $sock; } $hv += $this->_hashfunc($tries . $realkey); + $hv = $hv & 0x7fffffff; // don't let this pass the limit and go negative (bug 12342) } return false; -- 2.20.1