X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Flibs%2Fobjectcache%2FMemcachedBagOStuff.php;h=40f283621d9f1ab5ca3ef146166baa17c152404f;hb=e0d817b7f6a58875782f31bb025a9df5c3ac2a33;hp=dc409315f842704c41cd6a84fdc444c004cbfcb2;hpb=a89f844919271da2e7c4d2a540de6d0f516d845a;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/libs/objectcache/MemcachedBagOStuff.php b/includes/libs/objectcache/MemcachedBagOStuff.php index dc409315f8..40f283621d 100644 --- a/includes/libs/objectcache/MemcachedBagOStuff.php +++ b/includes/libs/objectcache/MemcachedBagOStuff.php @@ -49,29 +49,25 @@ abstract class MemcachedBagOStuff extends MediumSpecificBagOStuff { // custom prefixes used by thing like WANObjectCache, limit to 205. $charsLeft = 205 - strlen( $keyspace ) - count( $args ); - $args = array_map( - function ( $arg ) use ( &$charsLeft ) { - $arg = strtr( $arg, ' ', '_' ); + foreach ( $args as &$arg ) { + $arg = strtr( $arg, ' ', '_' ); - // Make sure %, #, and non-ASCII chars are escaped - $arg = preg_replace_callback( - '/[^\x21-\x22\x24\x26-\x39\x3b-\x7e]+/', - function ( $m ) { - return rawurlencode( $m[0] ); - }, - $arg - ); + // Make sure %, #, and non-ASCII chars are escaped + $arg = preg_replace_callback( + '/[^\x21-\x22\x24\x26-\x39\x3b-\x7e]+/', + function ( $m ) { + return rawurlencode( $m[0] ); + }, + $arg + ); - // 33 = 32 characters for the MD5 + 1 for the '#' prefix. - if ( $charsLeft > 33 && strlen( $arg ) > $charsLeft ) { - $arg = '#' . md5( $arg ); - } + // 33 = 32 characters for the MD5 + 1 for the '#' prefix. + if ( $charsLeft > 33 && strlen( $arg ) > $charsLeft ) { + $arg = '#' . md5( $arg ); + } - $charsLeft -= strlen( $arg ); - return $arg; - }, - $args - ); + $charsLeft -= strlen( $arg ); + } if ( $charsLeft < 0 ) { return $keyspace . ':BagOStuff-long-key:##' . md5( implode( ':', $args ) );