[BUGFIX] Cache missing class information only in productive context
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Classes / Core / ClassLoader.php
index f2b7226..4d9b4cc 100644 (file)
@@ -27,6 +27,11 @@ class ClassLoader {
 
        const VALID_CLASSNAME_PATTERN = '/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9\\\\_\x7f-\xff]*$/';
 
+       /**
+        * @var ApplicationContext
+        */
+       protected $context;
+
        /**
         * @var ClassAliasMap
         */
@@ -93,6 +98,7 @@ class ClassLoader {
         * @param ApplicationContext $context
         */
        public function __construct(ApplicationContext $context) {
+               $this->context = $context;
                $this->classesCache = new Cache\Frontend\StringFrontend('cache_classes', new Cache\Backend\TransientMemoryBackend($context));
        }
 
@@ -241,8 +247,10 @@ class ClassLoader {
                                        $this->isEarlyCache ? array('early') : array()
                                );
                        } elseif (!$this->isEarlyCache) {
-                               // Cache that the class is unknown
-                               $this->classesCache->set($cacheEntryIdentifier, '');
+                               if ($this->context->isProduction()) {
+                                       // Cache that the class is unknown
+                                       $this->classesCache->set($cacheEntryIdentifier, '');
+                               }
                        }
                }