From: Marcus Boerger Date: Mon, 6 Sep 2004 19:16:35 +0000 (+0000) Subject: MFH Fix handling of exceptions in dtors X-Git-Tag: php-5.0.2RC1~37 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9ae0e91ef4e9406a3f89731a3958402cd30f4d3e;p=php MFH Fix handling of exceptions in dtors --- diff --git a/Zend/zend_objects.c b/Zend/zend_objects.c index 85f76302fc..162905256b 100644 --- a/Zend/zend_objects.c +++ b/Zend/zend_objects.c @@ -76,10 +76,13 @@ ZEND_API void zend_objects_destroy_object(zend_object *object, zend_object_handl old_exception = EG(exception); EG(exception) = NULL; zend_call_method_with_0_params(&obj, object->ce, NULL, "__destruct", NULL); - if (EG(exception)) { - zval_ptr_dtor(&EG(exception)); + if (old_exception) { + if (EG(exception)) { + zend_error(E_ERROR, "Ignoring exception from %s::__destruct() while an exception is already active", object->ce->name); + zval_ptr_dtor(&EG(exception)); + } + EG(exception) = old_exception; } - EG(exception) = old_exception; } }