diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index e2dc2f2b5a..6d274e0786 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -53,14 +53,12 @@ class FrameworkExtension extends Extension if ($container->getParameter('kernel.debug')) { $loader->load('debug.xml'); + // only HttpKernel needs the debug event dispatcher $definition = $container->findDefinition('http_kernel'); - $definition->replaceArgument(2, new Reference('debug.controller_resolver')); - - // replace the regular event_dispatcher service with the debug one - $definition = $container->findDefinition('event_dispatcher'); - $definition->setPublic(false); - $container->setDefinition('debug.event_dispatcher.parent', $definition); - $container->setAlias('event_dispatcher', 'debug.event_dispatcher'); + $arguments = $definition->getArguments(); + $arguments[0] = new Reference('debug.event_dispatcher'); + $arguments[2] = new Reference('debug.controller_resolver'); + $definition->setArguments($arguments); } $configuration = $this->getConfiguration($configs, $container); diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/debug.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/debug.xml index 2d0d5ca324..e7d1c3c7d4 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/debug.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/debug.xml @@ -16,7 +16,7 @@ - + diff --git a/src/Symfony/Component/HttpKernel/DependencyInjection/RegisterListenersPass.php b/src/Symfony/Component/HttpKernel/DependencyInjection/RegisterListenersPass.php index d9d34b2f20..992c564aa7 100644 --- a/src/Symfony/Component/HttpKernel/DependencyInjection/RegisterListenersPass.php +++ b/src/Symfony/Component/HttpKernel/DependencyInjection/RegisterListenersPass.php @@ -50,11 +50,11 @@ class RegisterListenersPass implements CompilerPassInterface public function process(ContainerBuilder $container) { - if (!$container->hasDefinition($this->dispatcherService) && !$container->hasAlias($this->dispatcherService)) { + if (!$container->hasDefinition($this->dispatcherService)) { return; } - $definition = $container->findDefinition($this->dispatcherService); + $definition = $container->getDefinition($this->dispatcherService); foreach ($container->findTaggedServiceIds($this->listenerTag) as $id => $events) { $def = $container->getDefinition($id); diff --git a/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/RegisterListenersPassTest.php b/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/RegisterListenersPassTest.php index ade85bb1f1..5fc2097814 100644 --- a/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/RegisterListenersPassTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/DependencyInjection/RegisterListenersPassTest.php @@ -84,11 +84,8 @@ class RegisterListenersPassTest extends \PHPUnit_Framework_TestCase ->method('getDefinition') ->will($this->returnValue($definition)); - $builder->expects($this->atLeastOnce()) - ->method('findDefinition') - ->will($this->returnValue($definition)); - $registerListenersPass = new RegisterListenersPass(); + $registerListenersPass->process($builder); }