Skip to content

Commit

Permalink
[FrameworkBundle] Fix eager-loading of env vars in ConfigBuilderCache…
Browse files Browse the repository at this point in the history
…Warmer
  • Loading branch information
nicolas-grekas committed Feb 5, 2024
1 parent 8980568 commit a85889e
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 a85889e

Please sign in to comment.