fix: prevent composer install script failure on prestissimo check#232
fix: prevent composer install script failure on prestissimo check#232AaronFeledy wants to merge 1 commit intomainfrom
Conversation
…eck runs as root The install-composer.sh script checked for /var/www/.composer/composer.json but ran 'composer global remove' as root, where COMPOSER_HOME resolves to /root/.config/composer. When that directory has no composer.json, the command fails and set -e kills the entire build step. Fix: use COMPOSER_HOME to find the correct global composer.json, and add || true to prevent failures from breaking the build.
✅ Deploy Preview for lando-php ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
| # If upgrading from Composer 1 to 2, remove the prestissimo plugin | ||
| # which is incompatible with Composer 2 (parallel downloads are built-in now). | ||
| # Use COMPOSER_HOME to find the right global composer.json for the current user. | ||
| COMPOSER_HOME="${COMPOSER_HOME:-$(composer global config home --quiet 2>/dev/null || echo '')}" |
There was a problem hiding this comment.
--quiet flag suppresses composer config home value output
Medium Severity
The --quiet flag on composer global config home --quiet suppresses all standard output, including the config value itself. Composer uses Symfony Console, where --quiet sets verbosity to VERBOSITY_QUIET, causing write() to return without printing. This means the subcommand always produces empty output when COMPOSER_HOME isn't already set, so the fallback detection never works and the prestissimo removal block is silently skipped. Removing --quiet while keeping 2>/dev/null would suppress stderr warnings without losing the actual value on stdout.
|
Bugbot Autofix prepared fixes for 1 of the 1 bugs found in the latest run.
Or push these changes by commenting: Preview (c4bad65814)diff --git a/scripts/install-composer.sh b/scripts/install-composer.sh
--- a/scripts/install-composer.sh
+++ b/scripts/install-composer.sh
@@ -34,7 +34,7 @@
# If upgrading from Composer 1 to 2, remove the prestissimo plugin
# which is incompatible with Composer 2 (parallel downloads are built-in now).
# Use COMPOSER_HOME to find the right global composer.json for the current user.
-COMPOSER_HOME="${COMPOSER_HOME:-$(composer global config home --quiet 2>/dev/null || echo '')}"
+COMPOSER_HOME="${COMPOSER_HOME:-$(composer global config home 2>/dev/null || echo '')}"
if [ -n "$COMPOSER_HOME" ] && [ -f "$COMPOSER_HOME/composer.json" ]; then
if composer --version 2>/dev/null | grep -qE "Composer (version )?2\."; then
composer global remove hirak/prestissimo 2>/dev/null || true |




Problem
install-composer.shchecks for/var/www/.composer/composer.jsonbut runscomposer global remove hirak/prestissimoas root, whereCOMPOSER_HOMEresolves to/root/.config/composer. When that directory has nocomposer.json, the command fails andset -ekills the entire build step.This causes the joomla-import leia test to fail on
lando rebuildin every downstream recipe that uses the PHP builder (e.g. lando/joomla).Fix
COMPOSER_HOMEto resolve the correct globalcomposer.jsonpath|| trueso even if the remove fails, it doesn't break the buildhirak/prestissimopackage hasn't been relevant since Composer 1 anywayDownstream
Fixes CI failures in:
Note
Low Risk
Low risk shell-script change limited to Composer installation cleanup; main risk is masking a real failure due to
|| true, but it only affects optional plugin removal.Overview
Prevents
scripts/install-composer.shfrom failing during Composer installs by making the prestissimo cleanup conditional on the actual global config location.The script now resolves
COMPOSER_HOME(via env orcomposer global config home), checks for$COMPOSER_HOME/composer.json, and attemptscomposer global remove hirak/prestissimoonly when running Composer 2, swallowing any removal errors soset -edoesn’t break the build.Written by Cursor Bugbot for commit d0736e4. This will update automatically on new commits. Configure here.