Escape colons in BagOStuff key segments
authorOri Livneh <ori@wikimedia.org>
Fri, 23 Oct 2015 22:12:51 +0000 (15:12 -0700)
committerOri Livneh <ori@wikimedia.org>
Sat, 24 Oct 2015 03:26:49 +0000 (20:26 -0700)
commit0c9fb12265e2fe47616dbb0bcfac1ffeb008694e
tree655976b8e90ee54e4a9bcd724e9098548c77d870
parentcdb543272883b18000c6a522c6526fa7d72f4c1c
Escape colons in BagOStuff key segments

For the sake of safety and correctness, the following BagOStuff::makeKey()
invocations should return distinct keys:

   $cache->makeKey( 'ab:', 'cd' );
   $cache->makeKey( 'ab', ':cd' );

That is not currently the case, because while we use ':' as a key path
separator, we don't escape ':' in the input supplied to makeKey(). So, make
BagOStuff::makeKeyInternal() URL-encode colons.

To prevent this from messing up the max. key length calculations, reproduce
this logic in MemcachedBagOStuff::makeKeyInternal(), in lieu of having the
method call its parent.

Change-Id: I83ea7e7336a1c9e64aa42284c2517089a736efe5
includes/libs/objectcache/BagOStuff.php
includes/objectcache/MemcachedBagOStuff.php
tests/phpunit/includes/objectcache/BagOStuffTest.php
tests/phpunit/includes/objectcache/MemcachedBagOStuffTest.php