|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2021-01-15 14:14 UTC] cmb@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: cmb
[2021-01-15 14:14 UTC] cmb@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Nov 18 03:00:01 2025 UTC |
Description: ------------ I use a code like below on a server with php 5.1.6 for long, and the expected result below is the ACTUAL output of the code. Recently I have a new server running 5.3.3 and no luck. The point is the class instance is not able to be referenced when it runs to __destruct(). I use some functions to help object cleaning easier. Any comment or help will be appreciated. Test script: --------------- class Database { function __destruct() { echo "Destroyed Database\n"; }} class Session { private $db; function __construct() { $this->db = new Database(); } function __destruct() { echo "Destroyed Session\n"; check(); } } $sess = new Session(); check(); die(); function check(){ global $sess; if(isset($sess)) echo "yes\n"; else echo "no\n"; } Expected result: ---------------- yes Destroyed Session yes Destroyed Database Actual result: -------------- yes Destroyed Session no Destroyed Database