Skip to content

Fix GC crashes on lazy ghosts with PHP 8.4.27, 8.5.12 and 8.6 - #66

Merged
nicolas-grekas merged 2 commits into
mainfrom
lazy-ctx-gc
Nov 15, 2026
Merged

nicolas-grekas merged 2 commits into
mainfrom
lazy-ctx-gc

Conversation

@nicolas-grekas

@nicolas-grekas nicolas-grekas commented Nov 15, 2026 •

Copy link
Copy Markdown
Member

Since php/php-src#24061 (GH-24050), the GC destroys the table that get_gc returns for a garbage cycle. That's in PHP 8.4.27, 8.5.12 and 8.6.0RC5.

The context of the lazy ghosts returned its refs table, which is part of the context. When the GC collected an abandoned graph of ghosts, it corrupted memory: deepclone_from_array_lazy_gc.phpt crashes on these versions. The context now adds the values of the table to the GC buffer instead.

This affects released versions of PHP, so I'd release it soon.

Until php/php-src#25418 is settled, the test that compares the __sleep() warnings with serialize() cuts names at their first NUL byte on both sides. This way, this PR doesn't wait for #67.

@nicolas-grekas
nicolas-grekas merged commit 8c46419 into main Nov 15, 2026
47 of 49 checks passed
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.

1 participant