Bug #53769 [Opn]: Order to call __destruct on global way

From: Date: Sat, 26 Mar 2016 23:45:57 +0000
Subject: Bug #53769 [Opn]: Order to call __destruct on global way
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-200135@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=53769&edit=1 ID: 53769 Updated by: nikic@php.net Reported by: administrateur at exinsidephp dot com Summary: Order to call __destruct on global way Status: Open Type: Bug Package: Class/Object related Operating System: All PHP Version: 5.3.5 Block user comment: N Private report: N New Comment: Related to bug #66023 and bug #71722. Previous Comments: ------------------------------------------------------------------------ [2016-03-26 23:44:47] nikic@php.net Related To: Bug #66023 ------------------------------------------------------------------------ [2016-03-26 23:42:53] nikic@php.net Related To: Bug #71722 ------------------------------------------------------------------------ [2011-01-17 16:17:06] 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 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=53769&edit=1

« previous php.bugs (#200135) next »