Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Closed
@devsi

Description

@devsi

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions