Skip to content

Commit 1e06e3b

Browse files
committed
Fix weakmap
1 parent fc13fb6 commit 1e06e3b

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

Zend/zend_gc.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1444,7 +1444,6 @@ static void gc_scan_roots(gc_stack *stack)
14441444
* make sure to reload pointers. */
14451445
idx = GC_FIRST_ROOT;
14461446
end = GC_G(first_unused);
1447-
14481447
while (idx != end) {
14491448
repeat:
14501449
current = GC_IDX2PTR(idx);

Zend/zend_weakrefs.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,11 @@ static void zend_weakmap_write_dimension(zend_object *object, zval *offset, zval
421421
return;
422422
}
423423

424+
if (GC_TYPE_INFO(obj_addr) & (GC_NOT_COLLECTABLE << GC_FLAGS_SHIFT)) {
425+
GC_DEL_FLAGS(obj_addr, GC_NOT_COLLECTABLE);
426+
gc_check_possible_root((zend_refcounted *)obj_addr);
427+
}
428+
424429
zend_weakref_register(obj_addr, ZEND_WEAKREF_ENCODE(&wm->ht, ZEND_WEAKREF_TAG_MAP));
425430
zend_hash_index_add_new(&wm->ht, obj_key, value);
426431
}

0 commit comments

Comments
 (0)