Ability to intercept errors even if set_error_handler has been called
| From: | Mikko Koppanen | Date: | Tue, 17 Nov 2009 18:34:06 +0000 |
| Subject: | Ability to intercept errors even if set_error_handler has been called | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-46074@lists.php.net to get a copy of this message | ||
Hello,
In monitoring type extensions such as Xdebug, APM etc it is common to
override zend_error_cb with a custom callback to intercept errors.
This however has a drawback: if user calls set_error_handler the
zend_error_cb does not get called at all for errors that can be
handled in userspace. There are a few approaches to solving this
(namely disabling set_error_handler or overriding set_error_handler)
but neither of them really seems like a good solution.
I made a simple patch that adds always_invoke_error_cb which allows
invoking the zend_error_cb in these cases (it needs to be set on
explicitly in an extension). error_handled_by_user setting allows
extensions to stop propagating the event if it's handled by user's
handler.
The patch is very simple and probably breaks horribly with some edge
cases. Ideas? Feedback?
http://pastie.org/702900
--
Mikko Koppanen