]> granicus.if.org Git - php/commitdiff
MFH Fix handling of exceptions in dtors
authorMarcus Boerger <helly@php.net>
Mon, 6 Sep 2004 19:16:35 +0000 (19:16 +0000)
committerMarcus Boerger <helly@php.net>
Mon, 6 Sep 2004 19:16:35 +0000 (19:16 +0000)
Zend/zend_objects.c

index 85f76302fc4ac02d7e3f3822c4d440f32f193684..162905256b170830c9a92d72f0134eba1c86132a 100644 (file)
@@ -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;
        }
 }