Skip to content

Commit a9a1f40

Browse files
committed
Handle reallocated root buffer during GC destroy phase (v2)
We no longer protect GC during the destroy phase, so we need to deal with buffer reallocation. Note that the implementation of spl_SplObjectStorage_free_storage will call the destructor of SplObjectStorage, and free the instance properties, which I think is what caused the root buffer to be reallocated. This fixes bug #78811 for me.
1 parent f7c44ef commit a9a1f40

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Zend/zend_gc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1555,6 +1555,8 @@ ZEND_API int zend_gc_collect_cycles(void)
15551555
GC_ADD_FLAGS(obj, IS_OBJ_FREE_CALLED);
15561556
GC_ADDREF(obj);
15571557
obj->handlers->free_obj(obj);
1558+
current = GC_IDX2PTR(idx); // bug #78811: free_obj() can cause the root buffer to be reallocated.
1559+
obj = (zend_object*)GC_GET_PTR(current->ref);
15581560
GC_DELREF(obj);
15591561
}
15601562

0 commit comments

Comments
 (0)