Skip to content

Commit dd5652e

Browse files
committed
- Fix handling of exceptions in dtors
1 parent 963200c commit dd5652e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Zend/zend_objects.c

+6-3
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,13 @@ ZEND_API void zend_objects_destroy_object(zend_object *object, zend_object_handl
7676
old_exception = EG(exception);
7777
EG(exception) = NULL;
7878
zend_call_method_with_0_params(&obj, object->ce, NULL, "__destruct", NULL);
79-
if (EG(exception)) {
80-
zval_ptr_dtor(&EG(exception));
79+
if (old_exception) {
80+
if (EG(exception)) {
81+
zend_error(E_ERROR, "Ignoring exception from %s::__destruct() while an exception is already active", object->ce->name);
82+
zval_ptr_dtor(&EG(exception));
83+
}
84+
EG(exception) = old_exception;
8185
}
82-
EG(exception) = old_exception;
8386
}
8487
}
8588

0 commit comments

Comments
 (0)