X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=blobdiff_plain;f=includes%2Flibs%2Fobjectcache%2FMultiWriteBagOStuff.php;h=65f3a8afe5adecd7ae46494857432c5ab14560bc;hb=ace44e2064851dda9d9e7327494bd7b7b3379825;hp=9dcfa7c55eec5740f6c88388cf556a7b9ad1e885;hpb=47437e0653542aae57ea456b24486efb48ee8aac;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/libs/objectcache/MultiWriteBagOStuff.php b/includes/libs/objectcache/MultiWriteBagOStuff.php index 9dcfa7c55e..65f3a8afe5 100644 --- a/includes/libs/objectcache/MultiWriteBagOStuff.php +++ b/includes/libs/objectcache/MultiWriteBagOStuff.php @@ -174,13 +174,19 @@ class MultiWriteBagOStuff extends BagOStuff { * @param integer $count * @param bool $asyncWrites * @param string $method - * @param mixed ... + * @param mixed $args,... * @return bool */ protected function doWrite( $count, $asyncWrites, $method /*, ... */ ) { $ret = true; $args = array_slice( func_get_args(), 3 ); + if ( $count > 1 && $asyncWrites ) { + // Deep-clone $args to prevent misbehavior when something writes an + // object to the BagOStuff then modifies it afterwards, e.g. T168040. + $args = unserialize( serialize( $args ) ); + } + foreach ( $this->caches as $i => $cache ) { if ( $i >= $count ) { break; // ignore the lower tiers @@ -226,4 +232,12 @@ class MultiWriteBagOStuff extends BagOStuff { return $ret; } + + public function makeKey() { + return call_user_func_array( [ $this->caches[0], __FUNCTION__ ], func_get_args() ); + } + + public function makeGlobalKey() { + return call_user_func_array( [ $this->caches[0], __FUNCTION__ ], func_get_args() ); + } }