X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Flibs%2Fobjectcache%2FMemcachedClient.php;h=eecf7ec7997ec6ae0ca79d90873f4a41bff13722;hb=b2786ff37593e16c6d6c4ac12ac2df3aa78feaa2;hp=1cc07b71ef444293cbc873801ee3d56db6f749e9;hpb=bdc88d57e7e10b2554d7cbcf3914113a44c81719;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/libs/objectcache/MemcachedClient.php b/includes/libs/objectcache/MemcachedClient.php index 1cc07b71ef..eecf7ec799 100644 --- a/includes/libs/objectcache/MemcachedClient.php +++ b/includes/libs/objectcache/MemcachedClient.php @@ -255,8 +255,6 @@ class MemcachedClient { * Memcache initializer * * @param array $args Associative array of settings - * - * @return mixed */ public function __construct( $args ) { $this->set_servers( $args['servers'] ?? array() ); @@ -280,6 +278,23 @@ class MemcachedClient { } // }}} + + /** + * @param mixed $value + * @return string|integer + */ + public function serialize( $value ) { + return serialize( $value ); + } + + /** + * @param string $value + * @return mixed + */ + public function unserialize( $value ) { + return unserialize( $value ); + } + // {{{ add() /** @@ -505,7 +520,8 @@ class MemcachedClient { if ( $this->_debug ) { foreach ( $val as $k => $v ) { - $this->_debugprint( sprintf( "MemCache: sock %s got %s", serialize( $sock ), $k ) ); + $this->_debugprint( + sprintf( "MemCache: sock %s got %s", $this->serialize( $sock ), $k ) ); } } @@ -1020,7 +1036,7 @@ class MemcachedClient { * yet read "END"), these 2 calls would collide. */ if ( $flags & self::SERIALIZED ) { - $ret[$rkey] = unserialize( $ret[$rkey] ); + $ret[$rkey] = $this->unserialize( $ret[$rkey] ); } elseif ( $flags & self::INTVAL ) { $ret[$rkey] = intval( $ret[$rkey] ); } @@ -1074,7 +1090,7 @@ class MemcachedClient { if ( is_int( $val ) ) { $flags |= self::INTVAL; } elseif ( !is_scalar( $val ) ) { - $val = serialize( $val ); + $val = $this->serialize( $val ); $flags |= self::SERIALIZED; if ( $this->_debug ) { $this->_debugprint( sprintf( "client: serializing data as it is not scalar" ) );