note 63260 added to function.set-error-handler

From: Date: Fri, 17 Mar 2006 14:58:58 +0000
Subject: note 63260 added to function.set-error-handler
Groups: php.notes 
Request: Send a blank email to php-notes+get-105983@lists.php.net to get a copy of this message
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; ---- Server IP: 81.94.227.69 Probable Submitter: 193.238.212.160 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.set-error-handler.php Edit -- http://master.php.net/note/edit/63260 Del: integrated -- http://master.php.net/note/delete/63260/integrated Del: useless -- http://master.php.net/note/delete/63260/useless Del: bad code -- http://master.php.net/note/delete/63260/bad+code Del: spam -- http://master.php.net/note/delete/63260/spam Del: non-english -- http://master.php.net/note/delete/63260/non-english Del: in docs -- http://master.php.net/note/delete/63260/in+docs Del: other reasons-- http://master.php.net/note/delete/63260 Reject -- http://master.php.net/note/reject/63260 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#105983) next »