Encode non ASCII printable characters in cache keys for maximum compatibility with all cache backends

This commit is contained in:
Kijin Sung 2023-09-05 01:57:26 +09:00
parent 8054564b37
commit 206f6e706a

View file

@ -386,6 +386,10 @@ class Cache
*/
public static function getRealKey(string $key): string
{
$key = preg_replace_callback('/[^\x21-\x7E]/', function($match) {
return rawurlencode($match[0]);
}, $key);
if (preg_match('/^([^:]+):(.+)$/i', $key, $matches))
{
$key = $matches[1] . '#' . self::getGroupVersion($matches[1]) . ':' . $matches[2];