I'd be glad if someone could explain the architecture of PHP error handling to me. Some specific questions are:
It's pretty much as you suspect. A custom error handler has to probe for all settings itself and react accordingly.
The set_error_handler example first checks the current active error level, and compares it to the first callback parameter (bitwise and) which denotes the current error type:
if (!(error_reporting() & $errno)) {
But to initially test if you actually are supposed to print errors, you would need also:
ini_get("display_errors") or return;
Or to react to more settings and emulate the default error handler, even ini_get("html_errors")
etc. Unless you do all that manually, your user error handler would display all errors. They are not filtered, the callback receives everything.
The PHP default error handler is php_error_cb
around line 850 here:
http://svn.php.net/viewvc/php/php-src/trunk/main/main.c?revision=309647&view=markup#855
It does a bit more, but also queries the ini registry. That's where error_reporting
always saves the current state to.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With