From: Operating system: All PHP version: 5.3.5 Package: Class/Object related Bug Type: Bug Bug description:Order to call __destruct on global way
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 bug report at http://bugs.php.net/bug.php?id=53769&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=53769&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=53769&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=53769&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=53769&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=53769&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=53769&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=53769&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=53769&r=needscript Try newer version: http://bugs.php.net/fix.php?id=53769&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=53769&r=support Expected behavior: http://bugs.php.net/fix.php?id=53769&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=53769&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=53769&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=53769&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53769&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=53769&r=dst IIS Stability: http://bugs.php.net/fix.php?id=53769&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=53769&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=53769&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=53769&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=53769&r=mysqlcfg