]> granicus.if.org Git - php/commitdiff
- Fix crash in destructors(). You can't throw an exception in destructors
authorAndi Gutmans <andi@php.net>
Mon, 1 Mar 2004 19:45:07 +0000 (19:45 +0000)
committerAndi Gutmans <andi@php.net>
Mon, 1 Mar 2004 19:45:07 +0000 (19:45 +0000)
  as there is no guaranteed time when the destructor will be called.

Zend/zend_objects.c

index d29795e3aa0569cbdc14602b4a12942317df5ecb..bc4ac86f341e3cfcecb4ed70afe3e36baf0e91be 100644 (file)
@@ -68,7 +68,15 @@ ZEND_API void zend_objects_destroy_object(zend_object *object, zend_object_handl
                zobj.value.obj.handlers = &std_object_handlers;
                INIT_PZVAL(obj);
 
+               if (EG(exception)) {
+                       zval_ptr_dtor(&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));
+                       EG(exception) = NULL;
+               }
        }
 }