You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 2eb5402
Browse filesBrowse the repository at this point in the historyBrowse files
Evict the OPcache entry for a trapped path before the autoloader includes it
OPcache satisfies an include of an already-cached path from shared memory:
FileReadTrapStreamWrapper::stream_open() still runs, so the path is recorded,
but stream_read() never does, so the empty script the trap serves never
reaches the compiler and the real file executes a second time. A file
declaring a function then fatals with "Cannot redeclare", which is the
function-per-file layout of php-standard-library and azjezz/psl: a
files-autoload bootstrap loads every one of them at startup, and the same
paths stay reachable through a PSR-4 prefix for the autoloader to include
again.
Dropping the entry in stream_open() forces the include to read through the
wrapper. AutoloadSourceLocator invalidates the trapped paths once the trap is
done regardless, so this costs no recompilation that wasn't going to happen
anyway.
The OPcache-enabled probe moves out of servesParseError() into
opcacheEnabled() so both callers share the memoized check.
opcache.file_cache_only is not covered, and is documented as such: OPcache
reports itself disabled there, and no API evicts a file cache entry. That
configuration is left alone by TurboProcessRestarter, so PHPStan never turns
it on itself.
Closesphpstan/phpstan#15184
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
0 commit comments