I\'m trying to create a listener for listening 403, 404, and 500 exceptions. This works fine for 403 and 404 exceptions but not for 500 exceptions. For 500 exceptions (or ex
PHP 7 introduced fatal error exceptions. If you are in PHP 5.X the application stops.
First of all, ensure you cleared the Prod cache.
Second, see if something in the web server is catching errors for you, ie fastcgi_intercept_errors in Nginx, but this is unlikely to happen.
Third, try throwing an exception rather than calling a non-declared function.
Fourth, try to $event->setResponse as early as possible in the exception listener to ensure there's no error in the handler itself.
Other than that, I have no idea. The code seems to be Ok. Have you tried with XDebug to see how the code flows?