php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52479 Object destructor does not get called on fatal error
Submitted: 2010-07-29 03:11 UTC Modified: 2010-08-07 01:59 UTC
From: php-bugs at majkl578 dot cz Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.3.3 OS: Linux Debian
Private report: No CVE-ID: None
 [2010-07-29 03:11 UTC] php-bugs at majkl578 dot cz
Description:
------------
Class destructor does not get called when the script end with fatal error (eg. unknown function, uncaught exception etc.).

Test script:
---------------
class Foo {
	function __destruct() {
		touch('/tmp/foo');
	}
}

$x = new Foo;

throw new Exception;

Expected result:
----------------
New file /tmp/foo

Actual result:
--------------
Nothing

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-08-07 01:59 UTC] johannes@php.net
-Status: Open +Status: Bogus
 [2010-08-07 01:59 UTC] johannes@php.net
Fatal Errors keep the engine in undefined state we can't rely on the availability of the destructor anymore.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 14 05:01:34 2025 UTC