contao / manager-bundle

[READ-ONLY] Contao Manager Bundle
GNU Lesser General Public License v3.0
17 stars 10 forks source link

Array to string conversion #88

Closed jamesdevine closed 4 years ago

jamesdevine commented 4 years ago

The following code in src/Composer/ScriptHandler.php causes an "Array to string conversion" error if a command doesn't successfully run.

Line 94:

if (!$process->isSuccessful()) {
     throw new \RuntimeException(sprintf('An error occurred while executing the "%s" command: %s', $cmd, $process->getErrorOutput()));
}

$cmd is an array and not a string:

Line 60: private static function executeCommand(array $cmd, Event $event, string $env = 'prod'): void

fritzmg commented 4 years ago

@richardhj encountered the same problem.

$cmd is an array and not a string:

Technically it shouldn't be, because within composer a much older version of symfony/process is in use. See https://github.com/contao/contao/issues/1956

m-vo commented 4 years ago

Could anyone of you run the following? You need to set a breakpoint in the constructor of Process inside the composer.phar + have xdebug enabled on the CLI.

COMPOSER_ALLOW_XDEBUG=1 php -dxdebug.remote_enable=1 -dxdebug.remote_autostart=1 composer.phar run post-update-cmd

I'm curious about the used process version and the callstack. All process versions up to symfony/process v5.0 allow passing a string and contain the method setCommandline(). We use this to identify if we need to implode the string but it seems there is something going wrong.

leofeyer commented 4 years ago

See https://github.com/contao/contao/pull/2184