note 80883 added to function.set-error-handler

From: Date: Tue, 05 Feb 2008 17:33:02 +0000
Subject: note 80883 added to function.set-error-handler
Groups: php.notes 
Request: Send a blank email to php-notes+get-135794@lists.php.net to get a copy of this message
Looks like there's no way to distinguish between catched exceptions thrown by internal classes and real warnings in custom error handlers: <?php function handleError($n, $m, $f, $l) { //no difference between excpetions and E_WARNING echo "user error handler: e_warning=".E_WARNING." num=".$n." msg=".$m." line=".$l."\n"; return true; //change to return false to make the "catch" block execute; } set_error_handler('handleError'); //turn off to make try/catch work normally //uncomment this for a regular warning timezone_open(1202229163); //comment this whole try/catch out to see new DateTimeZone outside of a try / catch //behavior is the same if you have set a custom error handler //echo new DateTimeZone(1202229163); //* try { $z = new DateTimeZone(1202229163); } catch (Exception $e) { echo "caught"; } // */ ?> ---- Server IP: 64.71.164.2 Probable Submitter: 74.62.207.58 ---- Manual Page -- http://www.php.net/manual/en/function.set-error-handler.php Edit -- https://master.php.net/note/edit/80883 Del: integrated -- https://master.php.net/note/delete/80883/integrated Del: useless -- https://master.php.net/note/delete/80883/useless Del: bad code -- https://master.php.net/note/delete/80883/bad+code Del: spam -- https://master.php.net/note/delete/80883/spam Del: non-english -- https://master.php.net/note/delete/80883/non-english Del: in docs -- https://master.php.net/note/delete/80883/in+docs Del: other reasons-- https://master.php.net/note/delete/80883 Reject -- https://master.php.net/note/reject/80883 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#135794) next »