objectcache: minor fix to MultiWriteBagOStuff::doWrite()
authorAaron Schulz <aschulz@wikimedia.org>
Tue, 10 Jul 2018 20:44:24 +0000 (21:44 +0100)
committerKrinkle <krinklemail@gmail.com>
Thu, 12 Jul 2018 02:50:35 +0000 (02:50 +0000)
For the case of add(), any non-zero index can have async writes

Bug: T198239
Change-Id: I95f63143dcb894b9d12859c221f7d8e72fdf076f

includes/libs/objectcache/MultiWriteBagOStuff.php

index fd45024..da1f7b3 100644 (file)
@@ -202,7 +202,7 @@ class MultiWriteBagOStuff extends BagOStuff {
                $ret = true;
                $args = array_slice( func_get_args(), 3 );
 
-               if ( count( $indexes ) > 1 && $asyncWrites ) {
+               if ( array_diff( $indexes, [ 0 ] ) && $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 ) );