note 95054 added to function.set-exception-handler

From: Date: Fri, 11 Dec 2009 02:09:29 +0000
Subject: note 95054 added to function.set-exception-handler
Groups: php.notes 
Request: Send a blank email to php-notes+get-163837@lists.php.net to get a copy of this message
When an uncaught exception is handled, execution does NOT return to the script, but rather (unexpectedly, on my end anyway) terminates. I am using set_error_handler() and set_exception_handler() in conjunction for a system I am currently developing (on v5.3.0 with Xampp). Lets say two E_USER_NOTICES are triggered, the script will die after the first one is processed. <?php set_exception_handler( 'exc_handler' ); function exc_handler($exception) { echo "Uncaught exception: " , $exception->getMessage(), "\n"; } function errorone() { throw new Exception("Test 1"); } function errortwo() { throw new Exception("Test 2"); } function test() { errorone(); errortwo(); } test(); test(); ?> Instead of printing (as I'd expect) "Uncaught exception: Text 1\nUncaught exception: Text 2\nUncaught exception: Text 1\nUncaught exception: Text 2\n" It is only printed ONCE. I've tried a number of different things, but I can't figure out how to return execution to the script after the EXCEPTION HANDLER has run. If anyone has a solution on how to return execution (hence, allow the script to log uncaught exceptions but continue processing) then PLEASE email me! Thanks! ---- Server IP: 192.41.40.227 Probable Submitter: 76.167.60.11 ---- Manual Page -- http://www.php.net/manual/en/function.set-exception-handler.php Edit -- https://master.php.net/note/edit/95054 Del: integrated -- https://master.php.net/note/delete/95054/integrated Del: useless -- https://master.php.net/note/delete/95054/useless Del: bad code -- https://master.php.net/note/delete/95054/bad+code Del: spam -- https://master.php.net/note/delete/95054/spam Del: non-english -- https://master.php.net/note/delete/95054/non-english Del: in docs -- https://master.php.net/note/delete/95054/in+docs Del: other reasons-- https://master.php.net/note/delete/95054 Reject -- https://master.php.net/note/reject/95054 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#163837) next »