feat(opcache): relocate intersection/union type lists in cache binaries - #256
Merged
Merged
Conversation
6 tasks
…he payload Port the ZEND_TYPE_HAS_LIST branch of zend_file_cache_serialize_type / zend_file_cache_unserialize_type (ext/opcache/zend_file_cache.c, PHP-8.4.19): the zend_type_list pointer is relocated (SERIALIZE_PTR keeps walking through the still-real address, exactly like the C serialize/unserialize pair) and the walk recurses into every zend_type entry, so DNF sub-lists like (A&B)|C unfold naturally. The unsupportedPayload refusal for type lists is gone in both directions. New fixture tests/OpCache/fixtures/type-lists.php exercises a union parameter, a union return type, an intersection parameter and return type, and union/DNF property types (the DNF one nests an intersection list inside a union list). Acceptance evidence: - TypeListRelocationTest::testTypeListPayloadRoundTripsByteIdentical - the compiled fixture relocates and derelocates byte-for-byte - testUnmodifiedResaveStillExecutes / testPatchedTypeListFixtureExecutesFromCache - the re-serialized (and string-literal-patched) binary is executed by a fresh worker straight from the cache - full default suite, --group opcache --fail-on-skipped, phpstan level max and php-cs-fixer all green on PHP 8.4.19 NTS Fixes #112 Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BDcCQiYqbMkjRPyhWgLL6M
lisachenko
force-pushed
the
claude/opcache-112-relocate-type-lists
branch
from
August 19, 2026 21:59
0ca07da to
79f7cbe
Compare
lisachenko
marked this pull request as ready for review
August 19, 2026 22:37
This was referenced Aug 20, 2026
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 #112 — first of a five-PR stacked chain widening
PayloadRelocatorpayload coverage (#112 → #114 → #115 → #116 → #113; merge in order, GitHub retargets each next PR automatically).Ports the
ZEND_TYPE_HAS_LISTbranch ofzend_file_cache_(un)serialize_typefrom php-src 8.4:zend_type_listpointer relocation plus recursion into everyzend_typeentry (theZEND_TYPE_LIST_FOREACHwalk), both directions, keeping the CSERIALIZE_PTR/UNSERIALIZE_PTRwalk-through-real-address pattern. NewunserializeTypeStruct/serializeTypeStructinsrc/OpCache/PayloadRelocator.php; theunsupportedPayload('intersection/union type-list relocation')refusals are gone. Acceptance per the issue: fixture with union param/return, intersection param+return, union property and DNF property(A&B)|C|nullround-trips byte-for-byte and executes from the patched cache (TypeListRelocationTest: round trip, resave-executes, size-changing string patch executes).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-skippedgreen at this point of the chain (34 tests)Also (verified per-issue before each commit): full default suite baseline-identical;
--group opcache --fail-on-skippedgreen on release + debug; PHPStan level max clean; cs-fixer clean. Chain-final numbers on the #113 head: default suite 519 tests, opcache gate 47 tests, opcache-runner mode no new skips.Checklist
8.4) — fixes cascade upward, never downwardcomposer testpasses on the matching PHP minorcomposer phpstan(level max) andcomposer cs:checkare greenzend_type_listet al.) already in the generated defstools/generator/symbols.phpunchanged — nothing underinclude/,stubs/or.phpstorm.meta.phptouched🤖 Generated with Claude Code
https://claude.ai/code/session_01BDcCQiYqbMkjRPyhWgLL6M
Generated by Claude Code