Skip to content

Fix GH-21999: GC inconsistency after lazy object properties ht is added to roots#22013

Draft
arnaud-lb wants to merge 1 commit into
php:PHP-8.4from
arnaud-lb:gh21999
Draft

Fix GH-21999: GC inconsistency after lazy object properties ht is added to roots#22013
arnaud-lb wants to merge 1 commit into
php:PHP-8.4from
arnaud-lb:gh21999

Conversation

@arnaud-lb
Copy link
Copy Markdown
Member

Fixes GH-21999.

In the reproducer, a series of events causes a lazy object's properties ht to be a GC root [1]. The lazy object's get_gc() handler however doesn't return the properties ht in this case, but still exposes properties to the GC. This causes properties to be visited twice.

[1]: var_dump($obj) builds the object's properties ht, zend_compare_symbol_tables() adds it to GC roots.

@arnaud-lb arnaud-lb changed the title Fix GC inconsistency Fix GH-21999: GC inconsistency after lazy object properties ht is added to roots May 11, 2026
@arnaud-lb arnaud-lb changed the base branch from master to PHP-8.4 May 11, 2026 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GC assertion zend_gc_delref(zend_refcounted_h *): Assertion `p->refcount > 0' failed

1 participant