diff --git a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExceptionListenerPass.php b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExceptionListenerPass.php index 18d98b356d..9fbfd65950 100644 --- a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExceptionListenerPass.php +++ b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExceptionListenerPass.php @@ -28,9 +28,11 @@ class ExceptionListenerPass implements CompilerPassInterface } // register the exception controller only if Twig is enabled - $engines = $container->getParameter('templating.engines'); - if (!in_array('twig', $engines)) { - $container->removeDefinition('twig.exception_listener'); + if ($container->hasParameter('templating.engines')) { + $engines = $container->getParameter('templating.engines'); + if (!in_array('twig', $engines)) { + $container->removeDefinition('twig.exception_listener'); + } } } }