Skip to content

Commit

Permalink
bug #34755 [FrameworkBundle] resolve service locators in debug:* co…
Browse files Browse the repository at this point in the history
…mmands (nicolas-grekas)

This PR was merged into the 3.4 branch.

Discussion
----------

[FrameworkBundle] resolve service locators in `debug:*` commands

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #34470
| License       | MIT
| Doc PR        | -

Because of the way ServiceClosureArgument are dumped, we need to resolve locators after loading the xml dump of the container:
https://github.com/symfony/symfony/blob/3.4/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php#L273

Commits
-------

820da66 [FrameworkBundle] resolve service locators in `debug:*` commands
  • Loading branch information
chalasr committed Dec 6, 2019
2 parents ffcb691 + 820da66 commit 5807f5f
Showing 1 changed file with 3 additions and 0 deletions.
Expand Up @@ -20,6 +20,7 @@
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\DependencyInjection\Compiler\ServiceLocatorTagPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
Expand Down Expand Up @@ -198,6 +199,8 @@ protected function getContainerBuilder()
$container->compile();
} else {
(new XmlFileLoader($container = new ContainerBuilder(), new FileLocator()))->load($kernel->getContainer()->getParameter('debug.container.dump'));
$locatorPass = new ServiceLocatorTagPass();
$locatorPass->process($container);
}

return $this->containerBuilder = $container;
Expand Down

0 comments on commit 5807f5f

Please sign in to comment.