From d3b393cfed0b98fcf727f7d1ef401a2c0b9110d4 Mon Sep 17 00:00:00 2001 From: stampy Date: Fri, 23 Sep 2016 10:40:42 +0100 Subject: [PATCH] [HttpKernel] enabled cache-reloading when cache file is rebuilt This allows the cache file to be deleted and thus rebuilt between Container builds in WebTestCase scenario, to enable testing of multiple configurations of the same application through WebTestCase. --- src/Symfony/Component/HttpKernel/Kernel.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index f1013f23c61b2..361fd9c10b73b 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -479,15 +479,21 @@ protected function initializeContainer() $class = $this->getContainerClass(); $cache = new ConfigCache($this->getCacheDir().'/'.$class.'.php', $this->debug); $fresh = true; + for ($classVersion = 0; class_exists($class . ($classVersion ?: '')); $classVersion++); if (!$cache->isFresh()) { $container = $this->buildContainer(); $container->compile(); + $class .= $classVersion ?: ''; $this->dumpContainer($cache, $container, $class, $this->getContainerBaseClass()); $fresh = false; + } else { + $class .= $classVersion ? $classVersion - 1 : ''; } - require_once $cache->getPath(); + if(!in_array($class, get_declared_classes())) { + require $cache->getPath(); + } $this->container = new $class(); $this->container->set('kernel', $this); pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy