Include a bootstrap autoloader's located files for real before re-running it - #6291
Closed
ondrejmirtes wants to merge 1 commit into
Closed
Include a bootstrap autoloader's located files for real before re-running it#6291ondrejmirtes wants to merge 1 commit into
ondrejmirtes wants to merge 1 commit into
Conversation
…ning it The file-read trap's pseudo-include succeeds with dummy data, so a bootstrap autoloader that memoizes a require's result - deptrac's bootstrap caches $loader = require .../vendor/autoload.php in a closure static - is left holding an int instead of the class loader and never retries the require. The run-for-real fallback then re-runs a permanently broken autoloader and the class stays unresolvable: on a project using deptrac's contract interfaces this surfaced as "Internal error: Interface DEPTRAC_INTERNAL\...\EventSubscriberInterface not found", aborting the analysis. When the located files declare nothing under the wanted name and the redeclare gate allows a real run, include those files for real first - that performs the include the poisoned autoloader can no longer do itself. An autoload-infrastructure file registers its nested class loader, and locating the class again consults it through the file-read trap, so the class is still found statically. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014fMtimQECyyBNKTmFddr8L
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.
The file-read trap's pseudo-include succeeds with dummy data, so a bootstrap autoloader that memoizes a require's result — deptrac's
bootstrap.phpcaches$loader = require .../vendor/autoload.phpin a closure static — is left holding anintinstead of the class loader, and never retries the require. The run-for-real fallback added in 598faaa then re-runs a permanently broken autoloader, and the class stays unresolvable. On a project using deptrac's contract interfaces this surfaces as:aborting the analysis (this is also what turned the "other tests" jobs red since 598faaa, e.g. run 33088005533).
The fix: when the located files declare nothing under the wanted name and the redeclare gate allows a real run, include those files for real first — that performs the include the poisoned autoloader can no longer do itself. An autoload-infrastructure file registers its nested class loader, and locating the class again consults it through the file-read trap, so the class is still located statically without executing its file. The existing run-the-autoloaders fallback stays for the class_alias shapes.
The new
e2e/bug-15102dmirrors deptrac's memoizing bootstrap shape and fails withinterface.notFoundwithout the fix; the existing bug-15102/b/c cases stay green.🤖 Generated with Claude Code
https://claude.ai/code/session_014fMtimQECyyBNKTmFddr8L