Jump to content

LF pro, Exception problem


coolgk

Recommended Posts

Hi pro's  ;)

 

If you run the script below, you will get a fatal error (PHP 5.2.4), but the script is supposed to stop at the time exception is thrown out (i.e. this error should not get fired?)

 

if you uncomment class_exists('c2'), and run it, no error will happen (class_exists does not create an actually intance???).

 

So how come uncaught exception does not stop the script, still let the error fired.

 

Thanks heaps.

 

function test($e){
echo $e->getMessage();
}

set_exception_handler('test');

// class_exists('c2');
$x = new c2();
function __autoload($className){
echo "Autoload";
throw new Exception(' Failed');
}

 

Link to comment
https://forums.phpfreaks.com/topic/168885-lf-pro-exception-problem/
Share on other sites

From the manual....

 

When an exception is thrown, code following the statement will not be executed, and PHP will attempt to find the first matching catch block. If an exception is not caught, a PHP Fatal Error will be issued with an "Uncaught Exception ..." message, unless a handler has been defined with set_exception_handler().

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.