php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #45845 What about making destructors not run after calling die()?
Submitted: 2008-08-17 17:33 UTC Modified: 2008-08-17 18:02 UTC
From: faw217 at gmail dot com Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 5.3.0alpha1 OS: Ubuntu GNU/Linux 8.04
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: faw217 at gmail dot com
New email:
PHP Version: OS:

 

 [2008-08-17 17:33 UTC] 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.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-08-17 18:02 UTC] johannes@php.net
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
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 18:01:29 2024 UTC