On PHP5 it makes a whole lot of sense having both set_exception_handler()
and set_error_handler()
defined.
However, on PHP7 all (most?) errors are now exceptions. So, what's the point on defining both handlers, if even errors would pass by the exception handler instead?
I see there's a note on PHP7 new Error
class in the exception handler doc, but there's no reference to the fact there's no plain errors anymore, but Throwable
s, in the error handler function.
Since PHP 7, most errors are reported by throwing
Error
exceptions, which will be caught by the handler as well. BothError
andException
implements theThrowable
interface. [source]