diff --git a/system/Cache/Handlers/BaseHandler.php b/system/Cache/Handlers/BaseHandler.php index 7d7b936940e8..3cf8f38702a6 100644 --- a/system/Cache/Handlers/BaseHandler.php +++ b/system/Cache/Handlers/BaseHandler.php @@ -64,9 +64,9 @@ public static function validateKey($key, $prefix = ''): string { throw new InvalidArgumentException('Cache key cannot be empty.'); } - if (strpbrk($key, self::RESERVED_CHARACTERS) !== false) + if (strpbrk($key, static::RESERVED_CHARACTERS) !== false) { - throw new InvalidArgumentException('Cache key contains reserved characters ' . self::RESERVED_CHARACTERS); + throw new InvalidArgumentException('Cache key contains reserved characters ' . static::RESERVED_CHARACTERS); } // If the key with prefix exceeds the length then return the hashed version diff --git a/system/Cache/Handlers/FileHandler.php b/system/Cache/Handlers/FileHandler.php index 95bdfa0995b8..7f70cc848ec2 100644 --- a/system/Cache/Handlers/FileHandler.php +++ b/system/Cache/Handlers/FileHandler.php @@ -20,6 +20,12 @@ */ class FileHandler extends BaseHandler { + /** + * Reserved characters that cannot be used in a key or tag. + * From https://github.com/symfony/cache-contracts/blob/c0446463729b89dd4fa62e9aeecc80287323615d/ItemInterface.php#L43 + */ + public const RESERVED_CHARACTERS = '{}()\@:'; + /** * Maximum key length. *