Pass php error to default php error handler in my custom error handler -
Pass php error to default php error handler in my custom error handler -
i can't manage following: have error handler catches e_warnings
want handle of warnings other want ignore , pass them default php error handler (which takes other error types except e_warnings
).
is possible? @ simple error handler:
set_error_handler(function($errno, $errstr, $errfile, $errline, $errcontext) { if($errfile != 'somefile_for_example.php') { // don't care error throw somewhere else! } echo 'error in file handles custom error handler'; homecoming true; }, e_warning);
php documentation says at: http://php.net/manual/en/function.set-error-handler.php
it of import remember standard php error handler bypassed error types specified error_types unless callback function returns false.
maybe should work:
$old_error_handler = set_error_handler( function($errno, $errstr, $errfile, $errline, $errcontext) { if($errfile != 'somefile_for_example.php') { homecoming false; } echo 'error in file handles custom error handler'; homecoming true; }, e_warning);
-
[edit] user (philipp) commented set_error_handler returns old handler, custom one, not default handler.
-
in case, when programming error handlers, 1 must careful programming errors, cannot handled (maybe test functions first).
php error-handling
Comments
Post a Comment