note 22556 modified in function.ob-get-level by danbrown
| From: | danbrown@php.net | Date: | Thu, 04 Feb 2010 21:06:19 +0000 |
| Subject: | note 22556 modified in function.ob-get-level by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-165678@lists.php.net to get a copy of this message | ||
in case you wanted to use a function to use for deleting all buffered output (to clearly display
errors), you have it below
this eliminates the need for ob_end_clean_all() in php. good code :)
<?php
function condor_error($errno, $errstr, $errfile, $errline)
{
$errors = array(E_USER_ERROR, E_ERROR, E_PARSE);
if (in_array($errno,$errors)) {
while (ob_get_level()) {
ob_end_clean();
}
echo "<B>FATAL</B> [".$errno."]
".$errstr."<br>\n";
echo "Fatal error at line ".$errline." of file ".$errfile;
echo ", PHP ".PHP_VERSION." (".PHP_OS.")<br>\n";
echo "Aborting...<br><br>\n\n";
exit;
}
}
set_error_handler("condor_error");
?>
--was--
function condor_error($errno, $errstr, $errfile, $errline)
{
$errors = array(E_USER_ERROR, E_ERROR, E_PARSE);
if (in_array($errno,$errors)) {
while (ob_get_level()) {
ob_end_clean();
}
echo "<B>FATAL</B> [".$errno."]
".$errstr."<br>\n";
echo "Fatal error at line ".$errline." of file ".$errfile;
echo ", PHP ".PHP_VERSION." (".PHP_OS.")<br>\n";
echo "Aborting...<br><br>\n\n";
exit;
}
}
set_error_handler("condor_error");
in case you wanted to use a function to use for deleting all buffered output (to clearly display
errors), you have it above
this eliminates the need for ob_end_clean_all() in php. good code :)
http://php.net/manual/en/function.ob-get-level.php