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 44d3c5d
Browse filesBrowse the repository at this point in the historyBrowse files
Ask Composer's autoloaders for the file instead of letting them include it
AutoloadSourceLocator finds the file that declares a class by running the
autoloaders inside FileReadTrapStreamWrapper, which serves an empty script for
each file they include. When OPcache already holds the script, the include runs
the cached copy instead, so a file the process already ran executes again. A
file declaring a function then dies with "Cannot redeclare". That is the
function-per-file layout of php-standard-library, whose "files" autoload loads
paths that its PSR-4 prefix also resolves to.
Before running a Composer ClassLoader in the trap, ask its findFile() for the
path, so nothing is included. Other autoloaders, and paths behind a stream
wrapper such as the phar's own phar://, still go through the trap.
In the phar, php-scoper prefixes the ClassLoader import but Box leaves the class
unprefixed, so AutoloadSourceLocator.php joins the files where scoper.inc.php
removes that prefix again.
Closesphpstan/phpstan#15184
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
0 commit comments