I'm not trying to argue here,
I just asked a question, and you've managed to contradict your first post.

I just asked why this is the case, and if it is, is there any way I can work
WITH this functionality.

Your last post also indicates, that because the destructors are only called
after script termination, the scope of an object is global, always.
Is this true?

Also, I've called fwrite in a destructor before, so clearly not all IO is
terminated before the destructor is called.
When you refer to output facility, what are you talking about?

Many thanks
Daine Mamacos.


On Mon, 19 Dec 2005 20:16:07 +0100, Marcus Boerger wrote
> Hello Daine,
> 
>   you still don't get it. Your problem is the way php works. You 
> cannot put any output functionality in destructors because they are 
> called *after* your scipt is being terminted (to be precise after 
> the output facility has been shutdown on script termination).
> 
> This is btw a question the general php list.
> 
> marcus
> 
> Monday, December 19, 2005, 11:07:53 AM, you wrote:
> 
> > While you're example works, mine doesn't, it has to do with the class
> > assignment. If you actually bother to do anything with the class, it
doesn't work.
> 
> > $ php -r 'class blah { function __destruct() { throw new 
> > Exception("exception
> > thrown"); } } $blah = new blah();'
> 
> > give that a try and see what happens
> > (;
> > also http://bugs.php.net/bug.php?id=33598 clearly states that they cannoy be
> > thrown in the destructor.
> > Errrr... *shrug*
> 
> > On Fri, 16 Dec 2005 20:38:20 +0100, Marcus Boerger wrote
> >> Hello Daine,
> >> 
> >> [EMAIL PROTECTED] /usr/src/PHP_5_1 $ php -r 'class A{function 
> >> __destruct(){throw new Exception("A");}} new A;' make: 
> >> `sapi/cli/php' is up to date.
> >> 
> >> Fatal error: Uncaught exception 'Exception' with message 'A' in 
> >> Command line code:1 Stack trace:
> >> #0 Command line code(1): A::__destruct()
> >> #1 {main}
> >>   thrown in Command line code on line 1
> >> 
> >> As the code above clearly show, exceptions can be thrown.
> >> 
> >> marcus
> >> 
> >> Friday, December 16, 2005, 3:17:54 PM, you wrote:
> >> 
> >> > Is there any reason why one is not allowed to throw an exception in the
> >> > destructor of a class?
> >> > I mean, it makes sense, considering this is not always the final step
of code,
> >> > and it is usually used for finalising things, and it would be a good
idea to
> >> > know if anything goes wrong at that stage.
> >> > Otherwise is there any compromise one can use to "emulate" this feature?
> >> 
> >> > Daine Mamacos.
> >> 
> >> > --
> >> > random signature
> >> 
> >> Best regards,
> >>  Marcus
> >> 
> >> -- 
> >> PHP Internals - PHP Runtime Development Mailing List
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> > --
> > random signature
> 
> -- 
> Best regards,
>  Marcus                            mailto:[EMAIL PROTECTED]


--
random signature

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to