Skip to content

Commit 170a3f8

Browse files
committed
Don't set GC_HAS_DESTRUCTORS flag if destructors were already called
1 parent 2811e92 commit 170a3f8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Zend/zend_gc.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,8 +1158,9 @@ static int gc_collect_white(zend_refcounted *ref, uint32_t *flags, gc_stack *sta
11581158
if (!GC_INFO(ref)) {
11591159
gc_add_garbage(ref);
11601160
}
1161-
if (obj->handlers->dtor_obj != zend_objects_destroy_object ||
1162-
obj->ce->destructor != NULL) {
1161+
if (!(OBJ_FLAGS(obj) & IS_OBJ_DESTRUCTOR_CALLED)
1162+
&& (obj->handlers->dtor_obj != zend_objects_destroy_object
1163+
|| obj->ce->destructor != NULL)) {
11631164
*flags |= GC_HAS_DESTRUCTORS;
11641165
}
11651166
ZVAL_OBJ(&tmp, obj);

0 commit comments

Comments
 (0)