Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI CD pipeline error rtrim expects parameter 1 to be string, bool given #10670

Closed
Jaimin-Devhero opened this issue Mar 30, 2022 · 13 comments
Closed
Labels
Milestone

Comments

@Jaimin-Devhero
Copy link

@Jaimin-Devhero Jaimin-Devhero commented Mar 30, 2022

I have set up GitLab's CI CD pipeline in my project.

I am facing issues like the below error ("rtrim() expects parameter 1 to be string, bool given") when trying to run the composer install command from GitLab's ci cd pipeline job.
But when I run that command manually using ssh then works fine.

Please help me with this guys.

below is the error stash:

Fatal error: Uncaught TypeError: rtrim() expects parameter 1 to be string, bool given in phar:///usr/local/composer.phar/src/Composer/Config.php:377
Stack trace:
#0 phar:///usr/local/composer.phar/src/Composer/Config.php(377): rtrim(false, '/\')
#1 phar:///usr/local/composer.phar/src/Composer/Factory.php(180): Composer\Config->get('home')
#2 phar:///usr/local/composer.phar/src/Composer/Factory.php(324): Composer\Factory::createConfig(Object(Composer\IO\ConsoleIO), '/var/app/stagin...')
#3 phar:///usr/local/composer.phar/src/Composer/Factory.php(610): Composer\Factory->createComposer(Object(Composer\IO\ConsoleIO), Array, true, '/var/app/stagin...', true, false)
#4 phar:///usr/local/composer.phar/src/Composer/Console/Application.php(469): Composer\Factory::create(Object(Composer\IO\ConsoleIO), NULL, true, false)
#5 phar:///usr/local/composer.phar/src/Composer/Console/Application.php(411): Composer\Console\Application->getComposer(false, true)
#6 phar:///usr/local/composer.phar/src/Composer/Console/Application.php(352): Com in phar:///usr/local/composer.phar/src/Composer/Config.php on line 377

2022/03/30 11:35:14.949767 [ERROR] An error occurred during execution of command [app-deploy] - [Install composer dependencies]. Stop running the command. Error: installing composer dependencies failed with error: Command /bin/sh -c composer.phar install --no-ansi --no-interaction failed with error exit status 255. Stderr:Do not run Composer as root/super user! See https://getcomposer.org/root for details
PHP Fatal error: Uncaught TypeError: rtrim() expects parameter 1 to be string, bool given in phar:///usr/local/composer.phar/src/Composer/Config.php:377
Stack trace:
#0 phar:///usr/local/composer.phar/src/Composer/Config.php(377): rtrim(false, '/\')
#1 phar:///usr/local/composer.phar/src/Composer/Factory.php(180): Composer\Config->get('home')
#2 phar:///usr/local/composer.phar/src/Composer/Factory.php(324): Composer\Factory::createConfig(Object(Composer\IO\ConsoleIO), '/var/app/stagin...')
#3 phar:///usr/local/composer.phar/src/Composer/Factory.php(610): Composer\Factory->createComposer(Object(Composer\IO\ConsoleIO), Array, true, '/var/app/stagin...', true, false)
#4 phar:///usr/local/composer.phar/src/Composer/Console/Application.php(469): Composer\Factory::create(Object(Composer\IO\ConsoleIO), NULL, true, false)
#5 phar:///usr/local/composer.phar/src/Composer/Console/Application.php(411): Composer\Console\Application->getComposer(false, true)
#6 phar:///usr/local/composer.phar/src/Composer/Console/Application.php(352): Com in phar:///usr/local/composer.phar/src/Composer/Config.php on line 377

@Seldaek
Copy link
Member

@Seldaek Seldaek commented Mar 30, 2022

What Composer version are you running?

I can't make sense of why this would fail with latest code.. but yet it seems to fail.

If you can also make sure you run it with -vvv and share full output of the bootstrap it may hint at what the problem is.

@bensebborn
Copy link

@bensebborn bensebborn commented Mar 30, 2022

Same issue here, running from Ansible I get the above error. Running locally works fine

@Jaimin-Devhero
Copy link
Author

@Jaimin-Devhero Jaimin-Devhero commented Mar 30, 2022

Hello @Seldaek

My Composer version is: Composer 2.3.0 2022-03-30 11:15:36

@tisalmin
Copy link

@tisalmin tisalmin commented Mar 30, 2022

Same here, deploying to AWS and version is 2.3.0. Forcing deploy to use version 2.2.9 works.

@Seldaek
Copy link
Member

@Seldaek Seldaek commented Mar 30, 2022

OK I can repro, will hopefully get a fix out soon.

@Seldaek Seldaek added this to the 2.3 milestone Mar 30, 2022
@Seldaek Seldaek added the Bug label Mar 30, 2022
@Jaimin-Devhero Jaimin-Devhero changed the title CI C pipeline error rtrim expects parameter 1 to be string, bool given CI CD pipeline error rtrim expects parameter 1 to be string, bool given Mar 30, 2022
@bensebborn
Copy link

@bensebborn bensebborn commented Mar 30, 2022

Strangely the version pinning on install doesnt seem to work

php -c /etc/php-cli.ini /tmp/composer --install-dir=/usr/local/bin --filename=composer --version=2.2.10

[ec2-user@ip-10-0-202-128 ~]$ composer -V Composer 2.3.0 2022-03-30 11:15:36

@Seldaek
Copy link
Member

@Seldaek Seldaek commented Mar 30, 2022

Sorry just to make sure I can clean this up correctly, do all of you have the COMPOSER_HOME env var set? Because otherwise it seems you should be getting an exception about HOME being unset (which is the issue triggering the rtrim problem).

@clementmas
Copy link

@clementmas clementmas commented Mar 30, 2022

Yes COMPOSER_HOME is set properly. I'm also now getting this error all of the sudden on AWS Beanstalk.

@bensebborn
Copy link

@bensebborn bensebborn commented Mar 30, 2022

I don't explicity set that env var (Can't see that mentioned in install docs?) - Presume the install script sets that?

php -c /etc/php-cli.ini /tmp/composer --install-dir=/usr/local/bin --filename=composer --version=2.2.10

printenv COMPOSER_HOME
outputs nothing after install script is run

Out install script hasn't changed recently though so presume something in the upgrade has stopped the install script setting that env var?

@Seldaek
Copy link
Member

@Seldaek Seldaek commented Mar 30, 2022

https://github.com/composer/composer/releases/tag/2.3.1 is out now. Everyone please try release candidates next time :) If you update your scripts now you can change --version=xxx into --preview so you get the latest stable OR latest RC when available and you are ready to test the next one!

@bensebborn
Copy link

@bensebborn bensebborn commented Mar 30, 2022

@Seldaek the --version doesn't seem to work but I'll open a new ticket. Thanks for fix

@clementmas
Copy link

@clementmas clementmas commented Mar 30, 2022

That fixed it. Thanks for your reactivity @Seldaek!

I didn't know about the --preview flag.

@tisalmin
Copy link

@tisalmin tisalmin commented Mar 30, 2022

Sorry just to make sure I can clean this up correctly, do all of you have the COMPOSER_HOME env var set? Because otherwise it seems you should be getting an exception about HOME being unset (which is the issue triggering the rtrim problem).

Yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants