note 114471 added to function.restore-exception-handler
| From: | rl7 at shinyblue dot net | Date: | Mon, 24 Feb 2014 10:57:30 +0000 |
| Subject: | note 114471 added to function.restore-exception-handler | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-198625@lists.php.net to get a copy of this message | ||
Note that this does not work within an exception handler.
e.g.
<?php
function handler1(Exception $e) {
echo "handler1\n";
restore_exception_handler();
throw $e;
}
function handler2(Exception $e) {
echo "handler2\n";
}
set_exception_handler( 'handler2' );
set_exception_handler( 'handler1' );
throw new Exception( 'might expect to see handler1, handler2' );
/* Outputs:
handler1
PHP Fatal error: Uncaught exception 'Exception' with message 'might expect to see
handler1, handler2' in /tmp/demo.php:15
Stack trace:
#0 {main}
thrown in /tmp/demo.php on line 15
*/
?>
----
Server IP: 87.117.229.81
Probable Submitter: 146.90.164.172
----
Manual Page -- http://php.net/manual/en/function.restore-exception-handler.php
Edit -- https://master.php.net/note/edit/114471
Del: integrated -- https://master.php.net/note/delete/114471/integrated
Del: useless -- https://master.php.net/note/delete/114471/useless
Del: bad code -- https://master.php.net/note/delete/114471/bad+code
Del: spam -- https://master.php.net/note/delete/114471/spam
Del: non-english -- https://master.php.net/note/delete/114471/non-english
Del: in docs -- https://master.php.net/note/delete/114471/in+docs
Del: other reasons-- https://master.php.net/note/delete/114471
Reject -- https://master.php.net/note/reject/114471
Search -- https://master.php.net/manage/user-notes.php