composer: Composer 2.3.0 break symfony 3.4 app
Solution / workaround:
For such cases where script handlers are so old and unmaintained and won’t be fixed by third parties, if you cannot fix them yourself I would highly recommend storing a Composer 2.2 composer.phar in your old project directory. You can then use it with php composer.phar install
or similar to install legacy projects while still having a newer Composer installed globally on the machine for other projects.
For more workaround suggestions read the answers below.
Original issue below
Hi guys,
we use deployerphp, and we dl for each release the last release of composer for an sf app (3.4) and we encounter this error
here for 2.3.0 , (fyi no issue with 2.2.9 )
> symfony-scripts: Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap
In Process.php line 143:
[TypeError]
Argument 1 passed to Symfony\Component\Process\Process::__construct() must
be of the type array, string given, called in /var/www/example.com/releases/20220330124916/vendor/sensio/distribution-bundle/Composer/Scrip
tHandler.php on line 310
Exception trace:
at phar:///var/www/example.com/releases/20220330124916/composer.phar/vendor/symfony
/process/Process.php:143
Symfony\Component\Process\Process->__construct() at /var/www/example.com/releases/20
220330124916/vendor/sensio/distribution-bundle/Composer/ScriptHandler.php:310
Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::executeBuildBootstrap() at /var/www/example.com/releases/20220330124916/vendor/sensio/distribution-bundle/Composer/ScriptHa
ndler.php:88
Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap() at phar:///var/www/example.com/releases/20220330124916/composer.phar/src/Composer/EventDispatcher/EventDis
patcher.php:391
Composer\EventDispatcher\EventDispatcher->executeEventPhpScript() at phar:///var/www/example.com/releases/20220330124916/composer.phar/src/Composer/EventDispatcher/EventDispatcher.
php:248
Composer\EventDispatcher\EventDispatcher->doDispatch() at phar:///var/www/example.co
m/releases/20220330124916/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:108
Composer\EventDispatcher\EventDispatcher->dispatch() at phar:///var/www/example.com/
releases/20220330124916/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:228
Composer\EventDispatcher\EventDispatcher->doDispatch() at phar:///var/www/example.co
m/releases/20220330124916/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:125
Composer\EventDispatcher\EventDispatcher->dispatchScript() at phar:///var/www/example.com/releases/20220330124916/composer.phar/src/Composer/Installer.php:372
Composer\Installer->run() at phar:///var/www/example.com/releases/20220330124916/com
poser.phar/src/Composer/Command/InstallCommand.php:137
Composer\Command\InstallCommand->execute() at phar:///var/www/example.com/releases/2
0220330124916/composer.phar/vendor/symfony/console/Command/Command.php:298
Symfony\Component\Console\Command\Command->run() at phar:///var/www/example.com/rele
ases/20220330124916/composer.phar/vendor/symfony/console/Application.php:1015
Symfony\Component\Console\Application->doRunCommand() at phar:///var/www/example.com
/releases/20220330124916/composer.phar/vendor/symfony/console/Application.php:299
Symfony\Component\Console\Application->doRun() at phar:///var/www/example.com/releas
es/20220330124916/composer.phar/src/Composer/Console/Application.php:334
Composer\Console\Application->doRun() at phar:///var/www/example.com/releases/202203
30124916/composer.phar/vendor/symfony/console/Application.php:171
Symfony\Component\Console\Application->run() at phar:///var/www/example.com/releases
/20220330124916/composer.phar/src/Composer/Console/Application.php:130
Composer\Console\Application->run() at phar:///var/www/example.com/releases/20220330
124916/composer.phar/bin/composer:83
require() at /var/www/example.com/releases/20220330124916/composer.phar:29
install [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--dry-run] [--dev]
[--no-suggest] [--no-dev] [--no-autoloader] [--no-progress] [--no-install] [-v|vv|vvv|--verbose]
[-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader
-prefix APCU-AUTOLOADER-PREFIX] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-r
eqs] [--] [<packages>...]
Exception trace:
at phar:///usr/local/bin/dep/src/Ssh/Client.php:103
Deployer\Ssh\Client->run() at phar:///usr/local/bin/dep/src/functions.php:304
Deployer\run() at phar:///usr/local/bin/dep/recipe/deploy/vendors.php:15
Deployer\Deployer::Deployer\{closure}() at n/a:n/a
call_user_func() at phar:///usr/local/bin/dep/src/Task/Task.php:105
Deployer\Task\Task->run() at phar:///usr/local/bin/dep/src/Executor/SeriesExecutor.php:60
Deployer\Executor\SeriesExecutor->run() at phar:///usr/local/bin/dep/src/Console/TaskCommand.php:144
Deployer\Console\TaskCommand->execute() at phar:///usr/local/bin/dep/vendor/symfony/console/Command/Command.php:255
Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/dep/vendor/symfony/console/Application.php:924
Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/dep/src/Console/Application.php:133
Deployer\Console\Application->doRunCommand() at phar:///usr/local/bin/dep/vendor/symfony/console/Application.php:265
Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/dep/vendor/symfony/console/Application.php:141
Symfony\Component\Console\Application->run() at phar:///usr/local/bin/dep/src/Deployer.php:326
Deployer\Deployer::run() at phar:///usr/local/bin/dep/bin/dep:136
require() at /usr/local/bin/dep:4
any idea ? thanks guys we ❤️ you ! 😃
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 27
- Comments: 21 (8 by maintainers)
We’ve also had this issue in a few of our projects. Similar to @jjmackow, until we remove the sensio/distribution-bundle dependency, our fix was to either do:
composer self-update 2.2.9
or pass in the version to the Composer installer
--version=2.2.9
@hkorik yes that would require changes in the PatternLab repo (https://github.com/pattern-lab/patternlab-php/tree/master I guess?) it seems, same as SensioDistributionBundle it is way outdated though and not maintained anymore it seems.
For such cases I would highly recommend storing a Composer 2.2 composer.phar in these old project dirs, so you can use that to install them, but still have a newer composer installed on the machine for other projects. Ideally you would then migrate away from those outdated projects but I know in reality this is sometimes hard or impossible.
You can replace these with direct calls to
app/console
, something like"scripts": {"post-update-cmd": ["app/console cache:clear"]}
. The distribution bundle indirection adds no value there IIRC.The script handler of Sensio\Bundle\DistributionBundle does not seem to be compatible with the newer version of symfony/process shipped in composer 2.3
This is something to be fixed in Sensio\Bundle\DistributionBundle. alternatively, you could drop the
Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap
script entirely (IIRC, the bootstrap file that it generates does not bring any performance benefit on PHP 7+)Closing, hoping most affected people saw this by now.
I was having similar issues today (march 22nd, release day of 2.3.0 and 2.3.1) while trying to build Drupal 9.3.9 with composer 2.3.1 as well as 2.3.0. (I was getting issues regarding a file called autoload.php). simply run composer self-update 2.2.9 in the meanwhile to downgrade to the march 15th, 2022 release.
Yes, this is not a new problem. There’s just no solution to it, so not worth debating again.
Thanks u @stof ,
yup we have couple of scripts which use “Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::doSomthing” all ko. quick fix for us, is to simlply bring composer 2.2.9 during the time of upgrade sf deps before play with 2.3.0