Fixes #16028: Fix serialization of complex cache keys that contain non-UTF sequences

This commit is contained in:
Pavel Ivanov
2018-12-31 13:54:19 +02:00
committed by Alexander Makarov
parent 2b79a0c5ba
commit 7d494d0d24
3 changed files with 41 additions and 1 deletions

View File

@@ -52,4 +52,24 @@ class ArrayCacheTest extends CacheTestCase
static::$microtime++;
$this->assertFalse($cache->get('expire_testa'));
}
/**
* @see https://github.com/yiisoft/yii2/issues/16028
*/
public function testSerializationOfComplexKeysThatContainNonUTFSequences()
{
$cache = $this->getCacheInstance();
$firstCacheKey = $cache->buildKey([
"First example of invalid UTF-8 sequence: \xF5",
"Valid UTF-8 string",
]);
$secondCacheKey = $cache->buildKey([
"Second example of invalid UTF-8 sequence: \xF6",
"Valid UTF-8 string",
]);
$this->assertNotEquals($firstCacheKey, $secondCacheKey);
}
}