note 63260 rejected from function.set-error-handler by bjori
| From: | bjori@php.net | Date: | Fri, 17 Mar 2006 15:06:58 +0000 |
| Subject: | note 63260 rejected from function.set-error-handler by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-105984@lists.php.net to get a copy of this message | ||
Note Submitter: nikolai dot zujev at gmail dot com
----
Hi, I've found bug i thing, it seemed to me strange anyway. based on PHP 5. to reproduce
'bug':
<?php
error_reporting( E_ALL );
set_error_handler( 'error_handler' );
function error_handler( $errno, $errstr, $errfile, $errline )
{
echo "($errno) $errstr\n";
}
class someClass { /*....*/ }
unset( $test );
$o = new $test;
?>
output:
(8) Undefined variable: test
Fatal error: Class name must be a valid object or a string in /www/joople/nick/t1.php on line 16
It's OK.
but if we add [throw new Exception() ] into error_hander:
<?php
error_reporting( E_ALL );
set_error_handler( 'error_handler' );
function error_handler( $errno, $errstr, $errfile, $errline )
{
echo "($errno) $errstr\n";
throw new Exception( $errstr, $errno );
}
class someClass { /*....*/ }
unset( $test );
$o = new $test;
?>
Output will be like core dump, instead of [uncaughted exception].
I don't know how to catch this exception. :(
In other cases it works for me just fine;