Repository navigation
merge: cascade 8.5 into master (hot-swap cache fix, header refresh) - #306
Conversation
…eload next to opcache.preload Under PHP's default ffi.enable=preload a web SAPI may call the FFI API only from code that opcache.preload compiled at server start, so a bridge that was not preloaded cannot bind the engine at all - not even through FFI::scope() over definitions that ffi.preload published. Core::init() answered that with "Preload mode requires that you call Core::preload before", which names a method the operator has no place to call from. The exception is now the php.ini recipe with the paths resolved for the very build that failed: opcache.preload pointed at the bundled preload.php (any script that requires the autoloader does), opcache.preload_user for an FPM master running as root, what ffi.preload does and does not do, the Windows case where opcache.preload does not exist, and a diagnosis of the settings already in place. Core::preloadConfigurationHint() returns the same text on demand; Core::engineHeaderPath() resolves the ffi.preload value for the running build and Core::preloadScriptPath() the opcache.preload one. Configuring ffi.preload together with opcache.preload crashed the server start with a segmentation fault: the preload stage loaded the header into a scope that module startup had already published. Core::preload() now takes an existing scope as is and loads the header only when there is none. Tests run php-cgi (SAPI cgi-fcgi, restricted like php-fpm) next to the CLI binary: the exception carries the recipe, the recipe boots a request, both preloading mechanisms can be combined (the crash reproduces without the guard), and ffi.preload serves a request under ffi.enable=1. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VLQcsvgdQUzwBFsoKUAcG2
feat(core): explain the preload-mode configuration and survive ffi.preload next to opcache.preload
… swap
HotSwap compiles the new source as a donor class under the same name. When the
donor has a parent or interfaces, zend_do_link_class() stores it in the
engine's per-name class-entry cache. HotSwap republished the live entry in the
class table but left that cache pointing at the donor, so any later lookup by
an interned name (new ReflectionClass('Foo'), new Foo, ...) returned the donor
after it was destroyed on apply() or discard(): a use-after-free.
A PHP debug build catches it as a hash-table consistency abort in
ClassDeltaTest::testRemovedOverrideRestoresInheritedMethod; release builds
read freed memory silently.
ReflectionClass::bindClassNameCache() now repoints the slot, and HotSwap calls
it right after republishing the live class. The new regression test compares
class-entry addresses, so it fails on release builds too.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FxhC1Ec16gRujMto2EbKdR
PHP 8.4.27 added two engine fields: - zend_compiler_globals.interned_strings_fallible (_Bool, in the former padding at offset 443, so ast stays at 448) - zend_executor_globals.delayed_oom (new zend_oom_info struct, appended at the end; EG grows 1960 -> 1984 bytes, 2128 -> 2152 on ZTS) No existing offset moves. Regenerated with `composer gen-headers` (docker, php:8.4); the darwin and windows targets follow from their workflows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FxhC1Ec16gRujMto2EbKdR
chore(gen): regenerate 8.4 engine definitions for PHP 8.4.27
…govq fix(core): repoint the class-name cache at the live class after a hot swap
Brings the hot-swap class-name cache fix (#302) and the PHP 8.4.27 header refresh (#303) into 8.5. README conflict: kept the 8.5 side, which carries the Windows paragraph that the #299 cascade resolution added on purpose. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FxhC1Ec16gRujMto2EbKdR
PHP 8.5.12 carries the same engine additions as 8.4.27: - zend_compiler_globals.interned_strings_fallible (_Bool, former padding at offset 443) - zend_executor_globals.delayed_oom (zend_oom_info, appended at the end; EG grows 1984 -> 2008 bytes, 2152 -> 2176 on ZTS) No existing offset moves. Regenerated with `composer gen-headers` (docker, php:8.5). The branch-level stubs and .phpstorm.meta.php regenerate identical to what the cascade merge produced. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FxhC1Ec16gRujMto2EbKdR
The darwin generator now finds a ZTS PHP 8.5 build on the Intel macOS runner and committed include/8.5/darwin-x64-zts, which the README footnote said would happen automatically. The CI leg that skipped while the target was missing now runs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FxhC1Ec16gRujMto2EbKdR
setup-php now provides that build, and include/8.5/darwin-x64-zts is committed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FxhC1Ec16gRujMto2EbKdR
Brings the hot-swap class-name cache fix (#302) and the 8.4.27 / 8.5.12 header refreshes into master. Conflicts: - README.md: kept master's support table (with the 8.6 row) and updated the 8.5 row to darwin-x64 (nts, zts); dropped the footnote about the missing darwin-x64-zts 8.5 target, which now exists. - AGENTS.md: kept master's wording of the skipped-leg note. stubs/zend-engine-structs.php and .phpstorm.meta.php regenerated from the canonical 8.6 build (PHP 8.6.0RC2) rather than merged textually: 8.6.0RC2 does not have the delayed_oom / interned_strings_fallible backport, so they stay identical to master. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FxhC1Ec16gRujMto2EbKdR
…tswap-cache merge: cascade 8.4 into 8.5 (hot-swap cache fix, header refresh)
|
CI: the CI installs My local check used 8.6.0RC2, which is older than that backport, so I wrongly kept Fix in progress: I've started Generate linux headers, Generate darwin headers and Generate windows headers via Generated by Claude Code |
actions/upload-artifact skips hidden files unless include-hidden-files is set, so the linux-stubs artifact never carried .phpstorm.meta.php and the commit job could not refresh it. After the PHP 8.6 engine gained delayed_oom / interned_strings_fallible, the generator committed the new stubs but left the meta file stale, and header-drift kept failing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FxhC1Ec16gRujMto2EbKdR
…-master-hotswap-cache
What this changes
This is the last step of the cascade for #302 (the hot-swap class-name cache use-after-free fix):
8.4→8.5(#305, merged) →master.8.5is merged in (587aad9), and the merge added no content change.Merge
c1b6792(8.5 → master)README.mdconflict: I kept master's support table, with the 🚧 8.6 row. I updated the 8.5 row todarwin-x64 (nts, zts)and dropped its footnote, since merge: cascade 8.4 into 8.5 (hot-swap cache fix, header refresh) #305 addedinclude/8.5/darwin-x64-zts.AGENTS.mdconflict: I kept master's wording of the skipped-leg note.include/8.4/*andinclude/8.5/*definitions, andinclude/8.5/darwin-x64-zts.8.6 definitions refresh (
82eda89,abe0e22,a758d22)PHP 8.6.0-devcarries the same engine backport as 8.4.27 and 8.5.12. That iszend_compiler_globals.interned_strings_fallible(offset 443, former padding) andzend_executor_globals.delayed_oom(zend_oom_info, appended; EG grows 2200 → 2224 bytes). No existing offset moves.master's committedinclude/8.6/*,stubs/and.phpstorm.meta.phppredated the backport.Workflow fix (
2c29a5b)generate-linux-headers.ymlnow uploads the stubs artifact withinclude-hidden-files: true.actions/upload-artifactdrops dotfiles by default. So the generator never carried.phpstorm.meta.phpto its commit job, and that file could not be refreshed: the first regeneration left it stale and header drift stayed red. With the fix, the generator committed it itself (a758d22).Environment it was verified on
PHP 8.6.0-dev(61f6bc68) on every leg, plus localPHP 8.6.0RC2 (NTS DEBUG)--enable-debug)? yes, locally and in the internal-group legsCI run #533 on
a758d22passes all checks, including every header-drift leg. Locally on 8.6.0RC2 debug: 606 tests, the opcache gate and 165 internal-group tests all green.Checklist
8.5→master)composer testpasses on the matching PHP minorcomposer phpstan(level max) andcomposer cs:checkare greeninclude/,stubs/or.phpstorm.meta.phpwas hand-edited; all of it comes from the generator workflows🤖 Generated with Claude Code
https://claude.ai/code/session_01FxhC1Ec16gRujMto2EbKdR