[BUGFIX] Remove "cache_" prefix from cache configuration keys 92/60892/2
authorOliver Hader <oliver@typo3.org>
Thu, 6 Jun 2019 17:31:40 +0000 (19:31 +0200)
committerAndreas Fernandez <a.fernandez@scripting-base.de>
Wed, 19 Jun 2019 11:23:57 +0000 (13:23 +0200)
With #88366 "cache_" prefix has been deprecated. However, when
retrieving a deprecated cache like "cache_subject" its identifier
gets transformed to just "subject" which is (probably) not available
in cache configuration keys. That's why keys of cache configurations
have to be transformed as well.

Resolves: #88512
Releases: master
Change-Id: I224d55e71011a437ed2e990d13b1edbee08770b7
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60892
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Benni Mack <benni@typo3.org>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Benni Mack <benni@typo3.org>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
typo3/sysext/core/Classes/Cache/CacheManager.php

index c7b2cda..bc50ea4 100644 (file)
@@ -95,6 +95,11 @@ class CacheManager implements SingletonInterface
             if (!is_array($configuration)) {
                 throw new \InvalidArgumentException('The cache configuration for cache "' . $identifier . '" was not an array as expected.', 1231259656);
             }
+            // Fallback layer, will be removed in TYPO3 v11.0.
+            if (strpos($identifier, 'cache_') === 0) {
+                trigger_error('Accessing a cache with the "cache_" prefix as in "' . $identifier . '" is not necessary anymore, and should be called without the cache prefix.', E_USER_DEPRECATED);
+                $identifier = substr($identifier, 6);
+            }
             $this->cacheConfigurations[$identifier] = $configuration;
         }
     }