Description
Symfony version(s) affected: 4.1.6 (and probably earlier) [edit] confirmed up to 4.2.4
Description
When registering an additional error handler, in prod environment no error page is shown, even if correctly registered through the TwigBundle.
How to reproduce
This stems from getsentry/sentry-symfony#63, where @PapyDanone created a small reproduced of the issue here: https://github.com/PapyDanone/sentry-blank-page
I've tried to debug it but it's pretty hard, due to the fact that the issue seems to be in multiple registered error handlers. From what I've observed, the ErrorHandler frees some memory here, and afterward calls the fatal handler, which bails early here.
All of this is done without calling the Twig's exception listener which should call the setResponse
and show the custom error page. Since the behavior is commented, it's intentional, but I do not understand why Twig is not called in this case.
Additional context
Sentry error handler is registered here if you're interested, but it shouldn't matter: https://github.com/getsentry/sentry-php/blob/c266b71c031d3195ac3be5b9f442865753624799/lib/Raven/Client.php#L262-L277