From b179e081ab28aa494548ea6bea290f53cb79ca62 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov <dmitry@php.net> Date: Fri, 3 Feb 2006 09:31:59 +0000 Subject: [PATCH] Fixed bug #36268 (Object destructors called even after fatal errors) --- NEWS | 1 + Zend/tests/bug36268.phpt | 14 ++++++++++++++ main/main.c | 1 + 3 files changed, 16 insertions(+) create mode 100755 Zend/tests/bug36268.phpt diff --git a/NEWS b/NEWS index 2a6f4b1751..0707bcd48e 100644 --- a/NEWS +++ b/NEWS @@ -19,6 +19,7 @@ PHP NEWS - Added imap_savebody() that allows message body to be written to a file. (Mike) - Fixed imagecolorallocate() and imagecolorallocatelapha() to return FALSE on error. (Pierre) +- Fixed bug #36268 (Object destructors called even after fatal errors). (Dmitry) - Fixed bug #36258 (SplFileObject::getPath() may lead to segfault). (Tony) - Fixed bug #36242 (Possible memory corruption in stream_select()). (Tony) - Fixed bug #36235 (ocicolumnname returns false before a succesfull fetch). diff --git a/Zend/tests/bug36268.phpt b/Zend/tests/bug36268.phpt new file mode 100755 index 0000000000..5276d50d48 --- /dev/null +++ b/Zend/tests/bug36268.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #36268 (Object destructors called even after fatal errors) +--FILE-- +<?php +class Foo { + function __destruct() { + echo "Ha!\n"; + } +} +$x = new Foo(); +bar(); +?> +--EXPECTF-- +Fatal error: Call to undefined function bar() in %sbug36268.php on line 8 diff --git a/main/main.c b/main/main.c index 21c81e93b7..3c6d469742 100644 --- a/main/main.c +++ b/main/main.c @@ -820,6 +820,7 @@ static void php_error_cb(int type, const char *error_filename, const uint error_ AG(memory_limit) = PG(memory_limit); #endif efree(buffer); + zend_objects_store_mark_destructed(&EG(objects_store) TSRMLS_CC); zend_bailout(); return; } -- 2.40.0