-
-
Notifications
You must be signed in to change notification settings - Fork 882
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
Fix symfony 4.4 compat #3285
Fix symfony 4.4 compat #3285
Conversation
The ErrorListener may be remvoved from the container if deprecated configuration is used. We must use the deprecated Exception listener if so. https://github.com/symfony/symfony/blob/bfae515d521a421b413cb39e8fae727ffb4ca28b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExceptionListenerPass.php#L37
btw, users can fix this themselves by not using a deprecated twig configuration: |
{ | ||
if (class_exists(ErrorListener::class)) { | ||
if (null !== $errorListener) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you invert the test (test for === null
)
I have no idea why that |
It's not required, don't worry. |
It's because FOSUser isn't compatible with Symfony 4.4 yet. |
Thanks @bendavies |
If is not enough to check for the existence of
Symfony\Component\HttpKernel\EventListener\ErrorListener
to know if we can use it or not on symfony 4.4.It may have been removed from the container.
The new ErrorListener is functionally different to the deprecated one, as the new one flattens exceptions with the KernelEvents::CONTROLLER_ARGUMENTS event, and not when the attributes are added.
If
ErrorListener
is removed from the container, the exception will never be converted to a flattened exception, causing the wrong Exception type to be passed to the ExceptionAction.