Skip to content

VM: gc_collect_cycles invokes __destruct on cyclic graphs (#6519) - #7673

Merged
PurHur merged 1 commit into
masterfrom
agent/runtime-php-gc-destruct-6519
Jun 8, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/runtime-php-gc-destruct-6519

Conversation

@PurHur

@PurHur PurHur commented Jun 8, 2026

Copy link
Copy Markdown
Owner

Summary

Verification

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter "GcCollectCyclesDestructTest|gc_collect_cycles_destruct"'

Output:

OK (2 tests, 2 assertions)

Zend baseline (same repro):

dtor
dtor

Closes #6519

Made with Cursor

Zend defers destructor invocation on cyclic object graphs until
gc_collect_cycles() runs. Call invokeUserDestructor before releasing
unreachable objects in CycleCollector (phpc_gc.c already deleted).

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

php-in-php: phpc_gc.c shutdown destructors — GC cycle collection in lib/VM/Gc.php (Zend/zend_gc.c parity)

1 participant