Skip to content

Comments

fix: prevent composer install script failure on prestissimo check#232

Open
AaronFeledy wants to merge 1 commit intomainfrom
fix/composer-install-prestissimo-check
Open

fix: prevent composer install script failure on prestissimo check#232
AaronFeledy wants to merge 1 commit intomainfrom
fix/composer-install-prestissimo-check

Conversation

@AaronFeledy
Copy link
Member

@AaronFeledy AaronFeledy commented Feb 20, 2026

Problem

install-composer.sh checks for /var/www/.composer/composer.json but runs composer global remove hirak/prestissimo 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.

This causes the joomla-import leia test to fail on lando rebuild in every downstream recipe that uses the PHP builder (e.g. lando/joomla).

Fix

  • Use COMPOSER_HOME to resolve the correct global composer.json path
  • Add || true so even if the remove fails, it doesn't break the build
  • The hirak/prestissimo package hasn't been relevant since Composer 1 anyway

Downstream

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.sh from failing during Composer installs by making the prestissimo cleanup conditional on the actual global config location.

The script now resolves COMPOSER_HOME (via env or composer global config home), checks for $COMPOSER_HOME/composer.json, and attempts composer global remove hirak/prestissimo only when running Composer 2, swallowing any removal errors so set -e doesn’t break the build.

Written by Cursor Bugbot for commit d0736e4. This will update automatically on new commits. Configure here.

…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.
@netlify
Copy link

netlify bot commented Feb 20, 2026

Deploy Preview for lando-php ready!

Name Link
🔨 Latest commit d0736e4
🔍 Latest deploy log https://app.netlify.com/projects/lando-php/deploys/6998860d210d940008b1329b
😎 Deploy Preview https://deploy-preview-232--lando-php.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 91 (🔴 down 4 from production)
Accessibility: 98 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is ON. A Cloud Agent has been kicked off to fix the reported issue.

# 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 '')}"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--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.

Fix in Cursor Fix in Web

@cursor
Copy link

cursor bot commented Feb 20, 2026

Bugbot Autofix prepared fixes for 1 of the 1 bugs found in the latest run.

  • ✅ Fixed: --quiet flag suppresses composer config home value output
    • Removed the --quiet flag from the composer config home command while keeping 2>/dev/null to allow stdout (the config value) to pass through while still suppressing stderr warnings.

View PR

Or push these changes by commenting:

@cursor push c4bad65814
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant