Skip to content

Commit

Permalink
bug #53792 [FrameworkBundle] Fix eager-loading of env vars in ConfigB…
Browse files Browse the repository at this point in the history
…uilderCacheWarmer (nicolas-grekas)

This PR was merged into the 5.4 branch.

Discussion
----------

[FrameworkBundle] Fix eager-loading of env vars in ConfigBuilderCacheWarmer

| Q             | A
| ------------- | ---
| Branch?       | 5.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        | Fix #51255
| License       | MIT

Commits
-------

8de8869235 [FrameworkBundle] Fix eager-loading of env vars in ConfigBuilderCacheWarmer
  • Loading branch information
nicolas-grekas committed Feb 6, 2024
2 parents d8d2152 + a85889e commit b9eefbd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion CacheWarmer/ConfigBuilderCacheWarmer.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@
use Symfony\Component\Config\Builder\ConfigBuilderGenerator;
use Symfony\Component\Config\Builder\ConfigBuilderGeneratorInterface;
use Symfony\Component\Config\Definition\ConfigurationInterface;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\ConfigurationExtensionInterface;
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
use Symfony\Component\DependencyInjection\ParameterBag\ContainerBag;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface;
use Symfony\Component\HttpKernel\KernelInterface;

Expand Down Expand Up @@ -71,7 +74,8 @@ private function dumpExtension(ExtensionInterface $extension, ConfigBuilderGener
if ($extension instanceof ConfigurationInterface) {
$configuration = $extension;
} elseif ($extension instanceof ConfigurationExtensionInterface) {
$configuration = $extension->getConfiguration([], new ContainerBuilder($this->kernel->getContainer()->getParameterBag()));
$container = $this->kernel->getContainer();
$configuration = $extension->getConfiguration([], new ContainerBuilder($container instanceof Container ? new ContainerBag($container) : new ParameterBag()));
}

if (!$configuration) {
Expand Down

0 comments on commit b9eefbd

Please sign in to comment.