From 737653546a6201f8f6fbd0e15b72aac220076836 Mon Sep 17 00:00:00 2001 From: Matthew Flaschen Date: Fri, 27 Jun 2014 18:08:23 -0400 Subject: [PATCH] Don't unserialize integer reply from Redis incrBy It does not work with unserialize because RedisBagOStuff->unserialize expects either strings of digits, or serialized strings. A plain integer is neither. incr docs were incorrect, so fix and expand by copying from parent class. Change-Id: Ifc9c7a36f221b251ceea0d9a79ae6c3ce5753dd4 --- includes/objectcache/RedisBagOStuff.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/includes/objectcache/RedisBagOStuff.php b/includes/objectcache/RedisBagOStuff.php index 825c77b1e6..c7d2f13172 100644 --- a/includes/objectcache/RedisBagOStuff.php +++ b/includes/objectcache/RedisBagOStuff.php @@ -298,9 +298,9 @@ class RedisBagOStuff extends BagOStuff { * command. But we are constrained by the memcached-like interface to * return null in that case. Once the key exists, further increments are * atomic. - * @param string $key - * @param int $value - * @param bool|mixed + * @param string $key Key to increase + * @param int $value Value to add to $key (Default 1) + * @return int|bool New value or false on failure */ public function incr( $key, $value = 1 ) { $section = new ProfileSection( __METHOD__ ); @@ -313,7 +313,7 @@ class RedisBagOStuff extends BagOStuff { return null; } try { - $result = $this->unserialize( $conn->incrBy( $key, $value ) ); + $result = $conn->incrBy( $key, $value ); } catch ( RedisException $e ) { $result = false; $this->handleException( $conn, $e ); -- 2.20.1