Attached is a small patch that can let you do the following. If you set a custom error handler via set_error_handler() but don't want to implement all the details of handling every single error level, now you can simply handle the ones you are interested. Basically, if you return 1 from your error handler, then the PHP default error handler gets invoked, otherwise nothing happens. So:
function my_notice_handler($type, $str, $file, $line, $context) { if ($type == E_NOTICE || $type == E_USER_NOTICE) { /* do something */ return false; } else { /* let PHP default handler do it */ return true; } } It's backwards compatible with previous functionality, i.e. if you don't return anything, the default handler does not get invoked. Do you think it's harmless enough to include in PHP 5? - Andrei
? Zend/cscope.out Index: Zend/zend.c =================================================================== RCS file: /repository/Zend/Attic/zend.c,v retrieving revision 1.162.2.18 diff -u -p -r1.162.2.18 zend.c --- Zend/zend.c 8 Apr 2004 16:51:19 -0000 1.162.2.18 +++ Zend/zend.c 26 May 2004 22:38:47 -0000 @@ -812,6 +812,9 @@ ZEND_API void zend_error(int type, const orig_user_error_handler = EG(user_error_handler); EG(user_error_handler) = NULL; if (call_user_function_ex(CG(function_table), NULL, orig_user_error_handler, &retval, 5, params, 1, NULL TSRMLS_CC)==SUCCESS) { + if (zend_is_true(retval)) { + zend_error_cb(type, error_filename, error_lineno, format, args); + } zval_ptr_dtor(&retval); } else { /* The user error handler failed, use built-in error handler */
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php