From: Marcus Boerger Date: Mon, 6 Sep 2004 19:13:33 +0000 (+0000) Subject: - Fix handling of exceptions in dtors X-Git-Tag: PRE_ZEND_VM_DISPATCH_PATCH~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dd5652e4c15bbefc0d02c221e6f6bed978fd9a4c;p=php - 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; } }