Skip to content

feat(opcache): ZTS support for the file-cache relocator - #267

Merged
lisachenko merged 1 commit into
8.4from
claude/opcache-118-zts-relocator
Aug 20, 2026
Merged

feat(opcache): ZTS support for the file-cache relocator#267
lisachenko merged 1 commit into
8.4from
claude/opcache-118-zts-relocator

Conversation

@lisachenko

@lisachenko lisachenko commented Aug 19, 2026

Copy link
Copy Markdown
Owner

What this changes

Fixes #118 — now based directly on 8.4 (the relocator-coverage chain #256#260 has merged; this branch was rebased onto the current tip and carries only its own commit).

Lifts the ZTS refusal in PayloadRelocator::isSupported() + constructor. The refusal was precautionary, not structural: zend_file_cache.c has zero thread-safety conditionals, and a field-by-field diff of the generated layouts.json (linux-x64-nts vs -zts) shows every struct the walker dereferences is byte-identical — only zend_executor_globals/zend_compiler_globals/zend_module_entry differ, none of which appear in a payload. So no layout-dependent walking needed adapting and no generator changes.

Config/docs: composer.json test:opcache-zts drops --exclude-group opcache-relocator (name kept as CI's alias), ci.yml ZTS matrix + Windows-job ZTS opcache_args now cover the full group, AGENTS.md + docs mark ZTS supported, ZTS-naming skip messages removed.

Environment it was verified on

  • PHP version (full first line of php -v): PHP 8.4.19 (cli) NTS host; validation on a locally-built PHP 8.4.24 ZTS --enable-debug container (tools/docker/php-debug.Dockerfile --build-arg PHP_TS=zts)
  • Thread safety: NTS host + ZTS debug container
  • OS / architecture: Linux x86-64 (Ubuntu)
  • Debug build (--enable-debug)? yes — ZTS debug container: --group opcache --fail-on-skipped WITHOUT the relocator exclusion = OK (47 tests, 318 assertions), zero skips — every relocator test ran and passed on ZTS

Also: host full suite 519 tests, opcache gate 47, debug84 NTS 47; PHPStan level max clean; cs-fixer clean.

Checklist

  • Targets the minimum affected version branch (8.4)
  • composer test passes on the matching PHP minor
  • composer phpstan (level max) and composer cs:check are green
  • Tests added or updated; no new struct dereferences (ZTS layouts byte-identical for payload structs)
  • tools/generator/symbols.php unchanged — nothing under include/, stubs/ or .phpstorm.meta.php touched
  • Conventional Commits used for the commit messages

🤖 Generated with Claude Code

https://claude.ai/code/session_01BDcCQiYqbMkjRPyhWgLL6M


Generated by Claude Code

@lisachenko
lisachenko force-pushed the claude/opcache-113-relocate-property-hooks branch 4 times, most recently from f057e9d to 040e736 Compare August 19, 2026 23:28
Base automatically changed from claude/opcache-113-relocate-property-hooks to 8.4 August 19, 2026 23:40
@lisachenko

Copy link
Copy Markdown
Owner Author

Rebase and fix conflicts

Lift the ZTS refusal in PayloadRelocator (isSupported() and the constructor
throw). The refusal was precautionary, not structural: zend_file_cache.c
(PHP-8.4.19) contains no thread-safety conditionals, and a field-by-field
diff of the generated layouts.json for linux-x64-nts vs linux-x64-zts shows
every struct the walker dereferences (zend_persistent_script,
zend_file_cache_metainfo, zend_op_array, zend_class_entry, zend_string,
Bucket, zval, ...) is byte-identical - only zend_executor_globals,
zend_compiler_globals and zend_module_entry differ, none of which appear in
a payload. No layout-dependent walking needed adapting.

Config/docs follow: composer.json's test:opcache-zts drops the
--exclude-group opcache-relocator exclusion (name kept as the alias CI's ZTS
legs call), ci.yml's ZTS matrix comments/gates and the debug-job ZTS
opcache_args now cover the full opcache group, AGENTS.md and
docs/opcache-binary.md describe ZTS as supported, and the relocator tests'
skip message no longer names ZTS.

Acceptance evidence:
- z-engine-php:debug84-zts container (PHP 8.4.24 ZTS DEBUG, built from
  tools/docker/php-debug.Dockerfile with PHP_TS=zts):
  `phpunit --group opcache --fail-on-skipped` with NO relocator exclusion -
  OK (47 tests, 318 assertions), zero skips: every relocator test ran and
  passed on ZTS, byte-identical round trips included
- host NTS: full default suite (519 tests, skip/incomplete counts unchanged),
  --group opcache --fail-on-skipped OK (47), z-engine-php:debug84 NTS
  container OK (47), phpstan level max clean, php-cs-fixer clean

Fixes #118

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BDcCQiYqbMkjRPyhWgLL6M
@lisachenko
lisachenko force-pushed the claude/opcache-118-zts-relocator branch from 67fee31 to fb8bda9 Compare August 20, 2026 00:30

Copy link
Copy Markdown
Owner Author

Rebased — the whole #267#271 stack is replayed onto current 8.4 (78f2f20). The five already-merged relocator-chain commits dropped out as patch-equivalent, so each PR now carries exactly its own commit: this one is the single ZTS commit fb8bda9, based directly on 8.4.

Two real conflicts were resolved further up the stack (not in this PR): docs/opcache-binary.md (#269 vs the merged #122 doc rewrite — kept both the new "Graph growth" bullet and the accurate CacheImageSync "Deferred" text) and ReflectionOpcacheFile's constructor (#271 vs #122's $imageOwner buffer pin — combined). #268#270 are pushed too; #271 follows in a few minutes once its PHPStan pass over the reconciled constructor finishes re-validating.


Generated by Claude Code

@lisachenko
lisachenko marked this pull request as ready for review August 20, 2026 00:33
@lisachenko
lisachenko merged commit e7c3973 into 8.4 Aug 20, 2026
21 checks passed
@lisachenko
lisachenko deleted the claude/opcache-118-zts-relocator branch August 20, 2026 00:35
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.

feat(opcache): ZTS support for the file-cache relocator

2 participants