php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53769 Order to call __destruct on global way
Submitted: 2011-01-17 16:17 UTC Modified: 2016-03-26 23:45 UTC
From: administrateur at exinsidephp dot com Assigned:
Status: Open Package: Class/Object related
PHP Version: 5.3.5 OS: All
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: administrateur at exinsidephp dot com
New email:
PHP Version: OS:

 

 [2011-01-17 16:17 UTC] administrateur at exinsidephp dot com
Description:
------------
Hello,

In my opinion, the Garbage collector of PHP have a strange behavoir on order calling __destruct methods. So the documentation say that GB call __destruct of an instance of object after all references destroyed.

But this is not true if it have a reference on a static (global) scope. But for me a reference is one that is in a global scope or not.


I think this is a bug, and if this is not, can you explain to me why GB have this behavior ?

Test script:
---------------
http://pastebin.com/pTb1fqQK

Expected result:
----------------
Show C Destruct C Show B Destruct B Destruct A

Actual result:
--------------
Show C Destruct C Destruct A Show B Destruct B 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-03-26 23:45 UTC] nikic@php.net
Related to bug #66023 and bug #71722.
 [2022-12-12 06:16 UTC] melindaetinw81 at gmail dot com
I’m also having this exact issue. Did either of you have luck fixing it?
 (https://www.expresshr.ltd/)github.com
 [2022-12-12 06:16 UTC] melindaetinw81 at gmail dot com
I’m also having this exact issue. Did either of you have luck fixing it?
 (https://www.expresshr.ltd/)github.com
 [2022-12-12 06:16 UTC] melindaetinw81 at gmail dot com
I’m also having this exact issue. Did either of you have luck fixing it?
 (https://www.expresshr.ltd/)github.com
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC