Skip to content

ErrorException Array to string conversion in Process.php when looping the envs (start()) #44212

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

Closed
devsi opened this issue Nov 23, 2021 · 4 comments

Comments

@devsi
Copy link

devsi commented Nov 23, 2021

Symfony version(s) affected

4.4.34

Description

https://github.com/symfony/process/blob/5.3/Process.php#L342

In the start() method as of 4.4.34 we are now getting an Array to String conversion ErrorException.

This appears to also be present with the latest Laravel Framework update which is what caused us to start getting this issue. Every thing that uses the Symfony start() method is now throwing this error so its no one specific command causing it.

Seems to be something in the envs is being allowed through as an array. Previous 4.4.34 maybe they were not being stripped, or maybe a change in 4.4.34 allowed an array to end in the envs variable.

How to reproduce

start() symfony process method given a command line with arguments. In our case one example command was:

exec '/home/.nvm/versions/node/v12.3.1/bin/node' '/var/www/html/our-script.js' ''\''string_a'\''' ''\''string_b'\'''

$process = new Process(
            [
                $node,
                base_path() . '/our-script.js',
                escapeshellarg($string_a),
                escapeshellarg($string_b)
            ]
        );

where string_a and string_b are definitely strings ;)

Possible Solution

No response

Additional Context

Likely related to this PR that went in to 4.4.34:

#44070

@devsi
Copy link
Author

devsi commented Nov 23, 2021

Have added a comment on the line of code that was changed that I believe caused this issue. Hope this helps!

f608f0b#diff-edd51b05bf438c7cdca442e25d68f41dd0a51952a69fa0c5fa912dc31d833ef4L1677

@mpiecko
Copy link
Contributor

mpiecko commented Nov 23, 2021

I think this is related to #44197 (and a fix).

@fancyweb
Copy link
Contributor

Hello @devsi, thank you for reporting the issue. Can you apply this fix https://github.com/symfony/symfony/pull/44208/files manually please and tell us if it fixes the problem for you?

@nicolas-grekas
Copy link
Member

Closing as duplicate indeed.

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

No branches or pull requests

5 participants