note 84345 added to function.set-error-handler
| From: | wfinn at riverbed dot com | Date: | Thu, 10 Jul 2008 01:15:22 +0000 |
| Subject: | note 84345 added to function.set-error-handler | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-141341@lists.php.net to get a copy of this message | ||
"The following error types cannot be handled with a user defined function: E_ERROR, E_PARSE,
E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR, E_COMPILE_WARNING, and most of E_STRICT raised in the
file where set_error_handler() is called."
This is not exactly true. set_error_handler() can't handle them, but ob_start() can handle at
least E_ERROR.
<?php
function error_handler($output)
{
$error = error_get_last();
$output = "";
foreach ($error as $info => $string)
$output .= "{$info}: {$string}\n";
return $output;
}
ob_start('error_handler');
will_this_undefined_function_raise_an_error();
?>
----
Server IP: 208.69.120.35
Probable Submitter: 216.52.20.2
----
Manual Page -- http://www.php.net/manual/en/function.set-error-handler.php
Edit -- https://master.php.net/note/edit/84345
Del: integrated -- https://master.php.net/note/delete/84345/integrated
Del: useless -- https://master.php.net/note/delete/84345/useless
Del: bad code -- https://master.php.net/note/delete/84345/bad+code
Del: spam -- https://master.php.net/note/delete/84345/spam
Del: non-english -- https://master.php.net/note/delete/84345/non-english
Del: in docs -- https://master.php.net/note/delete/84345/in+docs
Del: other reasons-- https://master.php.net/note/delete/84345
Reject -- https://master.php.net/note/reject/84345
Search -- https://master.php.net/manage/user-notes.php