Symfony 2.4: Why are 500 errors not caught by kernel.exception listener

后端 未结 2 1150
夕颜
夕颜 2021-01-04 07:01

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

相关标签:
2条回答
  • 2021-01-04 07:12

    PHP 7 introduced fatal error exceptions. If you are in PHP 5.X the application stops.

    0 讨论(0)
  • 2021-01-04 07:30

    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?

    0 讨论(0)
提交回复
热议问题