#45845 [Opn->Bgs]: What about making destructors not run after calling die()?

[email protected]
Newsgroups php.bugs
Message-ID <[email protected]>
 ID:               45845
 Updated by:       [email protected]
 Reported By:      faw217 at gmail dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Feature/Change Request
 Operating System: Ubuntu GNU/Linux 8.04
 PHP Version:      5.3.0alpha1
 New Comment:

changing the behavior would break everybody relying on the current one.
And it's not worth to introduce such a specific feature to the core, you
can easily do something like

function my_own_die() {
    $GLOBALS['in_shutdown'] = true;
}

and then check that value in destructors...

for more info check other support facilities like the generals list,
see php.net/support.php


Previous Comments:
------------------------------------------------------------------------

[2008-08-17 17:33:17] faw217 at gmail dot com

Description:
------------
Hi, I was just wondering, how to make a destructor in a class not run
in some sort of situations (especially: after calling die() function)
and then I realised that it's impossible. But actually why?

Of course I can call a function manually but I think destructors were
created so that I can use them at the end of script execution time.
That's why I don't see a reason, why I shouldn't use them.
Of course I can use also register_shutdown_function(); but then I can't
change the output, since it is executed after ending with sending
request to webbrowser.

I think this feature (or change, call it as you want) will be sth, what
will make die() function different from exit language construct.

Consider this, please.



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=45845&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.