Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Change ExceptionListenerPass removeDefinition args #38483

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,11 @@ public function process(ContainerBuilder $container)

if ($container->hasParameter('templating.engines')) {
$engines = $container->getParameter('templating.engines');
if (\in_array('twig', $engines, true)) {
$container->removeDefinition('exception_listener');

return;
if (!\in_array('twig', $engines, true)) {
$container->removeDefinition('twig.exception_listener');
}
}

$container->removeDefinition('twig.exception_listener');
$container->removeDefinition('exception_listener');
adaniloff marked this conversation as resolved.
Show resolved Hide resolved
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,25 @@ public function testRemovesTwigExceptionListenerWhenNoExceptionListenerControlle
$this->assertFalse($builder->hasDefinition('twig.exception_listener'));
}

public function testRemovesBothExceptionListenerIfTwigIsNotUsedAsTemplateEngine(): void
{
$builder = new ContainerBuilder();
$builder->register('twig', Environment::class);
$builder->register('exception_listener', ExceptionListener::class);
$builder->register('twig.exception_listener', ExceptionListener::class);
$builder->setParameter('twig.exception_listener.controller', 'exception_controller::showAction');
$builder->setParameter('templating.engines', ['php']);

($pass = new ExceptionListenerPass())->process($builder);

$this->assertFalse($builder->hasDefinition('exception_listener'));
$this->assertFalse($builder->hasDefinition('twig.exception_listener'));
}

public function testRemovesTwigExceptionListenerIfTwigIsNotUsedAsTemplateEngine(): void
{
$this->markTestSkipped(sprintf('This test was implemented in accordance to version %. However, the implementation which this test cover was a behavior change.', '4.4.15'));
adaniloff marked this conversation as resolved.
Show resolved Hide resolved

$builder = new ContainerBuilder();
$builder->register('twig', Environment::class);
$builder->register('exception_listener', ExceptionListener::class);
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.