X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Flibs%2Fobjectcache%2FMultiWriteBagOStuff.php;h=200ab7969c9ad6de66febf9aba0e8c9df963c9fb;hb=d455aa29a685971c8191bc38383f1514e7cae806;hp=9dcfa7c55eec5740f6c88388cf556a7b9ad1e885;hpb=61898ad28ed69c5b391eb43e0db9386279b9612c;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/libs/objectcache/MultiWriteBagOStuff.php b/includes/libs/objectcache/MultiWriteBagOStuff.php index 9dcfa7c55e..200ab7969c 100644 --- a/includes/libs/objectcache/MultiWriteBagOStuff.php +++ b/includes/libs/objectcache/MultiWriteBagOStuff.php @@ -171,16 +171,22 @@ class MultiWriteBagOStuff extends BagOStuff { /** * Apply a write method to the first $count backing caches * - * @param integer $count + * @param int $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() ); + } }