Solved

PHP 5 Exception recovery

Posted on 2007-04-10
1
503 Views
Last Modified: 2010-08-05
Can you resume execution after an uncaught exception is picked up by the customized exception handler?

For example, in my error class:

set_exception_handler("userExceptionHandler");

If I have code that throws an exception which is not caught, userExceptionHandler() catches and handles it.  Can I recover from there?
0
Comment
Question by:Steve Bink
1 Comment
 
LVL 48

Accepted Solution

by:
hernst42 earned 500 total points
ID: 18887773
No, if the exception is handled by the global exception handler The script finish after that point. Example:

function myExceptionHandler (Exception $ex) { return true; }
set_exception_handler("myExceptionHandler");
throw new Exception("This should cause a fatal error and this message will be lost");
echo "Test";

'Test' is never printed.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question