[6.x] Fix Composer script events crashing when locating composer.json - #15434
Merged
Conversation
Composer registers the class autoloader for script events but never runs the autoload.files entries, so Laravel's helper functions don't exist. Env::get() evaluates value($default) when the variable is missing, which fataled every composer update/require via the pre-update-cmd hook. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Exercising Lock::backup() rather than the filename methods means anything later added anywhere the hook reaches is covered, not just the leaf. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
#15362 switched
Json::filename()toIlluminate\Support\Env::get('COMPOSER'). That call is reachable from thepre-update-cmdhook, and Composer registers only the class autoloader for script events — it never runs theautoload.filesentries, so none of Laravel's helper functions exist.Env::get()evaluatesvalue($default)when the variable is missing, so everycomposer update/composer requirefataled withCall to undefined function Illuminate\Support\value(). Setups actually using theCOMPOSERenv var were unaffected, since that takes the other branch.Reads the env var in vanilla PHP instead, using the same lookup order as
Env.