PHP 7.4 unable to catch Fatal error: Cannot redeclare <function>

QuestionsPHP 7.4 unable to catch Fatal error: Cannot redeclare <function>
Jehal Desai Staff asked 4 years ago

I loved the introduction of the Throwable interface and the ability to convert legacy Errors warnings and notices into catchable errors.
This is how I have rolled ever since:

However, some errors still can not be caught despite implementing all of these mechanisms.

This kind of thing is rare and really shouldn't happen but I still want to catch them somehow and provide a stack trace to devs with a constant error response.
Is this possible or do I just have to accept that even with modern PHP versions some errors still can not be caught?


View on Stack Overflow