Skip to content

Commit 8912a50

Browse files
author
Andi Gutmans
committed
- Fix crash in destructors(). You can't throw an exception in destructors
as there is no guaranteed time when the destructor will be called.
1 parent 161ed69 commit 8912a50

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Zend/zend_objects.c

+8
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,15 @@ ZEND_API void zend_objects_destroy_object(zend_object *object, zend_object_handl
6868
zobj.value.obj.handlers = &std_object_handlers;
6969
INIT_PZVAL(obj);
7070

71+
if (EG(exception)) {
72+
zval_ptr_dtor(&EG(exception));
73+
EG(exception) = NULL;
74+
}
7175
zend_call_method_with_0_params(&obj, object->ce, NULL, "__destruct", NULL);
76+
if (EG(exception)) {
77+
zval_ptr_dtor(&EG(exception));
78+
EG(exception) = NULL;
79+
}
7280
}
7381
}
7482

0 commit comments

Comments
 (0)