Solved

PHP 5 Exception recovery

Posted on 2007-04-10
1
484 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

This article discusses four methods for overlaying images in a container on a web page
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

743 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now