Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 16c382a

Browse filesBrowse files
committed
bug #41456 [FrameworkBundle] fix creating ContainerBuilder at warmup/CLI time (nicolas-grekas)
This PR was merged into the 5.3 branch. Discussion ---------- [FrameworkBundle] fix creating ContainerBuilder at warmup/CLI time | Q | A | ------------- | --- | Branch? | 5.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #41011, #41128 | License | MIT | Doc PR | - In prod mode, because we hack the kernel to recreate a container builder at runtime for introspection needs, we end up with a broken object graph. Calling `$this->initializeBundles()` creates fresh bundle instances and that fixes the issue. This could be merged on 5.2, but we don't need the fix on 5.2 because we never encountered the situation before adding the cache warmer for config builders. Commits ------- 74e297a [FrameworkBundle] fix creating ContainerBuilder at warmup/CLI time
2 parents 852cc29 + 74e297a commit 16c382a
Copy full SHA for 16c382a

File tree

1 file changed

+5
-1
lines changed
Filter options

1 file changed

+5
-1
lines changed

‎src/Symfony/Bundle/FrameworkBundle/Command/BuildDebugContainerTrait.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Command/BuildDebugContainerTrait.php
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@ protected function getContainerBuilder(KernelInterface $kernel): ContainerBuilde
4040
}
4141

4242
if (!$kernel->isDebug() || !(new ConfigCache($kernel->getContainer()->getParameter('debug.container.dump'), true))->isFresh()) {
43-
$buildContainer = \Closure::bind(function () { return $this->buildContainer(); }, $kernel, \get_class($kernel));
43+
$buildContainer = \Closure::bind(function () {
44+
$this->initializeBundles();
45+
46+
return $this->buildContainer();
47+
}, $kernel, \get_class($kernel));
4448
$container = $buildContainer();
4549
$container->getCompilerPassConfig()->setRemovingPasses([]);
4650
$container->getCompilerPassConfig()->setAfterRemovingPasses([]);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.