Re: Destructors will not be called after an exception is caught?

From: Date: Mon, 09 Aug 2004 05:28:10 +0000
Subject: Re: Destructors will not be called after an exception is caught?
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-12024@lists.php.net to get a copy of this message
Hello Noel, i suppose one of your destructors did throw an exception. But you didn't get any output from it. Try either 5.0.0-dev or 5.1.0-dev where the shutdown order wasaddressed again. A reproducing script would be this: php -r 'class t{function __destruct(){throw new exception(__METHOD__);}}$o=new t;' regards marcus Sunday, August 8, 2004, 4:17:47 PM, you wrote: > Hello all, > You'll have to excuse my ignorance if something like this has already > been posted. > In my process of writing complicated-for-the-sake-of-complicated scripts > (:D), I came across a very strange error: > Fatal error: Exception thrown without a stack frame in Unknown on line 0 > What was happening was that an Exception was being thrown in a class, > which in turn was caught by this (in psuedo-code): > try { > load_classes(); > } > catch (Exception $e) { > echo $e; > } > After the exception was caught and had been successfully printed to the > screen, the above fatal error occured. The cause of this error was a > __destruct() method in another class. Since the catch had killed the > script, the destructor was not able to execute, as far as I can tell. > I've confirmed this on PHP 5.0.0 on FreeBSD and PHP 5.0.0 RC3 on Win32. > Is this error message appropriate? Should this even be happening at all? > Any replies are welcomed. > Regards, > Noel Forbes -- Best regards, Marcus mailto:helly@php.net

« previous php.internals (#12024) next »