symfony/symfony — Issue #2821: [HttpKernel][Config][FileLocator] Multiple kernel initializations
Author: lisachenko
Created: 2011-12-09 09:53:13+00:00
State: open

There are multiple kernel initializations during unserialization of FileLocator object as it stores link to the kernel. So when cache metadata is unserialized then some more instances of kernel will be created.

Here trace for this:

Symfony\Component\Routing\Router->getMatcher()
Symfony\Component\Config\ConfigCache->isFresh(..)
unserialize(...O:47:"Symfony\Component\HttpKernel\Config\FileLocator":3:{s:55:"�Symfony\Component\HttpKernel\Config\FileLocator�kernel";C:9:"AppKernel":28:{a:2:{i:0;s:3:"dev";i:1;b:1;}}....)
Symfony\Component\HttpKernel\Kernel->unserialize(a:2:{i:0;s:3:"dev";i:1;b:1;})
AppKernel->__construct(dev, 1)

So, need to remove a link to the kernel during serialization of FIlelocator and need to take existing instance of Kernel during unserialization.