Our years of PHP code have largely used exception handling by converting traditional errors to exceptions using set_error_handler () and set_exception_handler (). After switching to PHP 7 for some of our servers, errors like this started to be pumped out:
Uncaught TypeError: Argument 1 passed to DataStellar\General\Exception_Handler::getContext() must be an instance of Exception, instance of Error given
We can use the \ Throwable as type hint, but most of our code bases are still on PHP 5 servers.
Is it possible to easily convert an Error object to an Exception object here?
source
share