mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-09 11:44:10 +09:00
Encode non ASCII printable characters in cache keys for maximum compatibility with all cache backends
This commit is contained in:
parent
8054564b37
commit
206f6e706a
1 changed files with 4 additions and 0 deletions
|
|
@ -386,6 +386,10 @@ class Cache
|
||||||
*/
|
*/
|
||||||
public static function getRealKey(string $key): string
|
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))
|
if (preg_match('/^([^:]+):(.+)$/i', $key, $matches))
|
||||||
{
|
{
|
||||||
$key = $matches[1] . '#' . self::getGroupVersion($matches[1]) . ':' . $matches[2];
|
$key = $matches[1] . '#' . self::getGroupVersion($matches[1]) . ':' . $matches[2];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue