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

Getting an error "proc_open() expects parameter 1 to be string, array given" #12

Closed
SadeeshKumarMN opened this issue Mar 9, 2021 · 3 comments

Comments

@SadeeshKumarMN
Copy link

SadeeshKumarMN commented Mar 9, 2021

Problem Statement: While execute the script composer db-docker -vvv --db-file=<<name of the db file>> getting an error:

[ErrorException]
  proc_open() expects parameter 1 to be string, array given

Other Details:

  • Composer Version:2.0.11
  • Drupal Version: 8.9.6

ExceptionTrace:

 () at phar:///usr/local/bin/composer/vendor/symfony/process/Process.php:285
 Composer\Util\ErrorHandler::handle() at n/a:n/a
 proc_open() at phar:///usr/local/bin/composer/vendor/symfony/process/Process.php:285
 Symfony\Component\Process\Process->start() at phar:///usr/local/bin/composer/vendor/symfony/process/Process.php:196
 Symfony\Component\Process\Process->run() at /Users/sadeeshkumarmn/Desktop/code/cypress-drupal-ci/cypress-drupal-gitlab/vendor/axelerant/db-docker/src/DbDockerCommand.php:280
 Axelerant\DbDocker\DbDockerCommand->execCmd() at /Users/sadeeshkumarmn/Desktop/code/cypress-drupal-ci/cypress-drupal-gitlab/vendor/axelerant/db-docker/src/DbDockerCommand.php:256
 Axelerant\DbDocker\DbDockerCommand->buildImage() at /Users/sadeeshkumarmn/Desktop/code/cypress-drupal-ci/cypress-drupal-gitlab/vendor/axelerant/db-docker/src/DbDockerCommand.php:86
 Axelerant\DbDocker\DbDockerCommand->execute() at phar:///usr/local/bin/composer/vendor/symfony/console/Command/Command.php:245
 Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:835
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:185
 Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:310
 Composer\Console\Application->doRun() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:117
 Symfony\Component\Console\Application->run() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:122
 Composer\Console\Application->run() at phar:///usr/local/bin/composer/bin/composer:63
 require() at /usr/local/bin/composer:24

db-docker [-t|--docker-tag [DOCKER-TAG]] [-r|--git-remote [GIT-REMOTE]] [-s|--db-source [DB-SOURCE]] [-f|--db-file [DB-FILE]] [--no-push]

Project Repo:
https://gitorious.xyz/sadeesh.kumar/cypress-drupal-gitlab

@hussainweb
Copy link
Member

hussainweb commented Mar 13, 2021

After analysis, I am seeing this happens because db-docker uses the symfony/process component which is embedded inside the composer phar file. This is built with version 2.8.52 of symfony/process (see its composer.lock).

This version of symfony/process does not support arrays at all (the support was added in version 3.3). What's strange is how is this working at all (because it is working in other cases). I am currently investigating this.

As for the fix, I am thinking of adding support for the ProcessBuilder class (which was deprecated in 3.4.0 and removed in 4.0. Naturally, the support should be conditional should composer decide to update the version at any time.

@hussainweb
Copy link
Member

I see why it works in my tests. As of PHP 7.4, proc_open now supports array for the command-line parameter and handles the escaping by itself. @SadeeshKumarMN, I suppose you are on an older PHP version, right?

In any case, we intend to support PHP 7.3 at least, for now. So, we still need to implement a workaround.

hussainweb added a commit that referenced this issue Mar 13, 2021
Add support for symfony/process 2.8. Fixes #12
@SadeeshKumarMN
Copy link
Author

@hussainweb Still observe a different error after upgrade to PHP 7.4. Raised an issue for tracking. Please look into this

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

No branches or pull requests

2 participants