php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60497 PHP Destructor not called after object save
Submitted: 2011-12-12 03:33 UTC Modified: 2013-12-06 07:36 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: mat999 at gmail dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.3.8 OS: Ubuntu
Private report: No CVE-ID: None
 [2011-12-12 03:33 UTC] mat999 at gmail dot com
Description:
------------
After saving an object in __destruct, __destruct is not called again.

Test script:
---------------
class ClassSave {
	function __destruct(){
		global $test;
		$test = $this;
		echo "Destruct\r\n";
	}
}

echo "1: ";
new ClassSave();
echo "2: ";
$test = null;
unset($test);
echo "End\r\n";

Expected result:
----------------
1: Destruct
2: Destruct
End

Actual result:
--------------
1: Destruct
2: End

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-12-06 07:36 UTC] mike@php.net
-Status: Open +Status: Not a bug
 [2013-12-06 07:36 UTC] mike@php.net
.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 16:01:36 2025 UTC