feat(opcache): relocate PHP 8.4 property hooks in cache binaries - #260
Merged
Conversation
lisachenko
force-pushed
the
claude/opcache-113-relocate-property-hooks
branch
from
August 19, 2026 21:59
8f9bb30 to
cc37a01
Compare
6 tasks
lisachenko
force-pushed
the
claude/opcache-113-relocate-property-hooks
branch
from
August 19, 2026 22:40
cc37a01 to
a661d63
Compare
lisachenko
force-pushed
the
claude/opcache-113-relocate-property-hooks
branch
from
August 19, 2026 23:08
a661d63 to
c6a4d31
Compare
lisachenko
force-pushed
the
claude/opcache-113-relocate-property-hooks
branch
from
August 19, 2026 23:17
c6a4d31 to
f057e9d
Compare
…load Port the prop->hooks branch of zend_file_cache_serialize_prop_info / zend_file_cache_unserialize_prop_info (ext/opcache/zend_file_cache.c, PHP-8.4.19): the zend_function*[ZEND_PROPERTY_HOOK_COUNT] array is relocated, and each non-NULL hook slot is converted and its op_array walked in both directions (hook bodies shared with the class function_table return early through the existing opcodes guard, as in C). NULL get/set slots stay NULL. The last payload-shape refusal is gone; only the platform refusals (Windows/32-bit, ZTS - issues #119/#118) remain. The hooked-class get_iterator field holds HOOKED_ITERATOR_PLACEHOLDER in the file; it is execution-only and preserved verbatim (see the #116 notes on unserializeIteratorFuncs), so the placeholder round-trips untouched. New fixture tests/OpCache/fixtures/property-hooks.php compiles a property with both get and set hooks, a get-only virtual property and a set-only backed property. Acceptance evidence: - PropertyHookRelocationTest::testPropertyHookPayloadRoundTripsByteIdentical - byte-for-byte round trip of the compiled fixture - testUnmodifiedResaveStillExecutes / testPatchedPropertyHookFixtureExecutesFromCache - the re-serialized (and patched) binary executes get/set hooks from the cache ('0:40:gauge-40:0:...' proves both hooks, the virtual getter and the set-only clamp ran) - full default suite, --group opcache --fail-on-skipped (host and z-engine-php:debug84 container), opcache-runner mode (opcache.enable_cli=1, --exclude-group performance/internal/opcache-incompatible), phpstan level max and php-cs-fixer all green Fixes #113 Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BDcCQiYqbMkjRPyhWgLL6M
lisachenko
force-pushed
the
claude/opcache-113-relocate-property-hooks
branch
from
August 19, 2026 23:28
f057e9d to
040e736
Compare
lisachenko
marked this pull request as ready for review
August 19, 2026 23:32
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
Fixes #113 — final PR of the relocator-coverage chain (stacked on #259). With this, the last payload-shape refusal is gone:
PayloadRelocatorhandles every compile-producible 8.4 payload; only the platform refusals remain (Windows/32-bit by policy, ZTS pending #118).Ports the
prop->hooksbranch ofzend_file_cache_(un)serialize_prop_info: relocates thezend_function*[ZEND_PROPERTY_HOOK_COUNT]array (count 2, private const following the file's precedent —constants.phpdoesn't export it), converts each non-NULL slot, and recurses into each hook op_array (shared bodies early-return via the opcodes guard, as in C). Acceptance: fixture with get+set hooks, a get-only virtual property, and a set-only backed property — byte-identical round trip and patched execution proving both hooks, the virtual getter and the set clamp run from the cache (PropertyHookRelocationTest).docs/opcache-binary.mdscope updated.Environment it was verified on
php -v): PHP 8.4.19 (cli) (built: Mar 30 2026 19:28:35) (NTS)--enable-debug)? yes — debug 8.4 container--group opcache --fail-on-skippedOK (47 tests, 318 assertions) on this chain headChain-final verification on this head: full default suite
Tests: 519, Assertions: 5250(baseline skips/incompletes only); opcache-runner modeTests: 517, Skipped: 6(all pre-existing/issue-linked); PHPStan level max clean; cs-fixer clean.Checklist
8.4)composer testpasses on the matching PHP minorcomposer phpstan(level max) andcomposer cs:checkare greenprop->hooksfield already in the generated defstools/generator/symbols.phpunchanged — nothing generated touched🤖 Generated with Claude Code
https://claude.ai/code/session_01BDcCQiYqbMkjRPyhWgLL6M
Generated by Claude Code