Pārlūkot izejas kodu

[HttpKernel] changed the way compiled classes are managed to be sure that they are included before the Kernel is booted

If not, as classes can be loaded during the boot, there is no way to be sure that
a class will not be already loaded by a third party bundle.

If the Kernel is already booted, we don't included the compiled classes.
Fabien Potencier 14 gadi atpakaļ
vecāks
revīzija
e16c226a5c
1 mainītis faili ar 4 papildinājumiem un 6 dzēšanām
  1. 4 6
      src/Symfony/Component/HttpKernel/Kernel.php

+ 4 - 6
src/Symfony/Component/HttpKernel/Kernel.php

@@ -397,12 +397,8 @@ abstract class Kernel implements KernelInterface
      */
     public function loadClassCache($name = 'classes', $extension = '.php')
     {
-        if (!$this->booted) {
-            $this->boot();
-        }
-
-        if ($this->container->hasParameter('kernel.compiled_classes')) {
-            ClassCollectionLoader::load($this->container->getParameter('kernel.compiled_classes'), $this->getCacheDir(), $name, $this->debug, false, $extension);
+        if (!$this->booted && file_exists($this->getCacheDir().'/classes.map')) {
+            ClassCollectionLoader::load(include($this->getCacheDir().'/classes.map'), $this->getCacheDir(), $name, $this->debug, false, $extension);
         }
     }
 
@@ -645,6 +641,8 @@ abstract class Kernel implements KernelInterface
         $container->addCompilerPass(new AddClassesToCachePass($this));
         $container->compile();
 
+        file_put_contents($this->getCacheDir().'/classes.map', sprintf('<?php return %s;', var_export($container->getParameter('kernel.compiled_classes'), true)));
+
         return $container;
     }