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

Symfony\Component\Process expects an array not a string. #1081

Open
Daimyo7 opened this issue Mar 30, 2022 · 4 comments
Open

Symfony\Component\Process expects an array not a string. #1081

Daimyo7 opened this issue Mar 30, 2022 · 4 comments

Comments

@Daimyo7
Copy link

Daimyo7 commented Mar 30, 2022

Summary

Oro\Bundle\InstallerBundle\Composer\ScriptHandler::setPermissions
In Process.php line 143:

[TypeError]
Symfony\Component\Process\Process::__construct(): Argument #1 ($command) must be of type array, string given, called in /var/www/html/vendor/oro/platform/src/Oro/Bundle/InstallerBundle/Composer/Permission
sHandler.php on line 111

Steps to reproduce
composer run-script post-update-cmd
or composer run-script post-install-cmd

Actual Result
string(94) "ps aux|grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx'|grep -v root|head -1|cut -d' ' -f1"
going through line 110 return new Process($commandline);

Expected Result
string(94) "ps aux|grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx'|grep -v root|head -1|cut -d' ' -f1"
going through line 110 return new Process([$commandline]); // AS an ARRAY

Details about your environment

  • OroPlatform version: 5.0.2
  • PHP version: 8.1.4
  • Database (MySQL) version 8

Custom Dockerfile

Additional information
https://github.com/symfony/process/blob/5.4/Process.php

Oro\Bundle\InstallerBundle\Composer\ScriptHandler::setPermissions
string(94) "ps aux|grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx'|grep -v root|head -1|cut -d' ' -f1"

In Process.php line 143:

[TypeError]
Symfony\Component\Process\Process::__construct(): Argument #1 ($command) must be of type array, string given, called in /var/www/html/vendor/oro/platform/src/Oro/Bundle/InstallerBundle/Composer/PermissionsHandler.php on line 111

Exception trace:
at phar:///usr/local/bin/composer/vendor/symfony/process/Process.php:143
Symfony\Component\Process\Process->__construct() at /var/www/html/vendor/oro/platform/src/Oro/Bundle/InstallerBundle/Composer/PermissionsHandler.php:111
Oro\Bundle\InstallerBundle\Composer\PermissionsHandler->getProcess() at /var/www/html/vendor/oro/platform/src/Oro/Bundle/InstallerBundle/Composer/PermissionsHandler.php:95
Oro\Bundle\InstallerBundle\Composer\PermissionsHandler->runProcess() at /var/www/html/vendor/oro/platform/src/Oro/Bundle/InstallerBundle/Composer/PermissionsHandler.php:81
Oro\Bundle\InstallerBundle\Composer\PermissionsHandler->getUsers() at /var/www/html/vendor/oro/platform/src/Oro/Bundle/InstallerBundle/Composer/PermissionsHandler.php:49
Oro\Bundle\InstallerBundle\Composer\PermissionsHandler->setPermissionsSetfacl() at /var/www/html/vendor/oro/platform/src/Oro/Bundle/InstallerBundle/Composer/PermissionsHandler.php:28
Oro\Bundle\InstallerBundle\Composer\PermissionsHandler->setPermissions() at /var/www/html/vendor/oro/platform/src/Oro/Bundle/InstallerBundle/Composer/ScriptHandler.php:196
Oro\Bundle\InstallerBundle\Composer\ScriptHandler::setPermissions() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:391
Composer\EventDispatcher\EventDispatcher->executeEventPhpScript() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:248
Composer\EventDispatcher\EventDispatcher->doDispatch() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:108
Composer\EventDispatcher\EventDispatcher->dispatch() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:228
Composer\EventDispatcher\EventDispatcher->doDispatch() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:125
Composer\EventDispatcher\EventDispatcher->dispatchScript() at phar:///usr/local/bin/composer/src/Composer/Installer.php:372
Composer\Installer->run() at phar:///usr/local/bin/composer/src/Composer/Command/UpdateCommand.php:241
Composer\Command\UpdateCommand->execute() at phar:///usr/local/bin/composer/vendor/symfony/console/Command/Command.php:298
Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:1015
Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:299
Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:334
Composer\Console\Application->doRun() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:171
Symfony\Component\Console\Application->run() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:130
Composer\Console\Application->run() at phar:///usr/local/bin/composer/bin/composer:83
require() at /usr/local/bin/composer:29

@mbessolov
Copy link
Member

Internal issue ID: BAP-21304

@mbessolov
Copy link
Member

@Daimyo7 as a workaround you can use an older version of composer (anything prior to 2.3.0 should work). All composer versions are available for download here - https://getcomposer.org/download/

@Daimyo7
Copy link
Author

Daimyo7 commented Mar 31, 2022

Ok I'll update the Dockerfile and set
https://github.com/mlocati/docker-php-extension-installer/
Composer back to 2.3.0.
Give me a moment to test it.

@Daimyo7
Copy link
Author

Daimyo7 commented Mar 31, 2022

Ok setting the composer back to 2.2 was able to pass over the command array type error.

Thanks for the response. I'll be sure to post a version of my Dockerfile later to a open project.

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

No branches or pull requests

2 participants