|  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 Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
15 + 2 = ?
Subscribe to this entry?

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

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:

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

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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-03-26 23:45 UTC]
Related to bug #66023 and bug #71722.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Oct 26 16:03:34 2021 UTC