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

Skip to content

[Process] ARGV array in env resulting in "Array to string conversion" error #44534

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
rbaarsma opened this issue Dec 9, 2021 · 0 comments
Closed

Comments

@rbaarsma
Copy link
Contributor

rbaarsma commented Dec 9, 2021

Symfony version(s) affected

5.4.0

Description

See #44197

Only difference is that ARGV is coming in with capital letters and therefore not caught by the if statement on Process.php line 343

if (false !== $v && 'argc' !== $k && 'argv' !== $k) {

How to reproduce

We are following the standard approach for liuggio/fastest bundle, executing our tests with this command:

docker-compose exec php bash -c "find tests/ -name \"*Test.php\" | vendor/liuggio/fastest/fastest \"XDEBUG_MODE=coverage bin/phpunit {} --coverage-php cov/fastest/{n}.cov;\""

A simple debug of the $env at this point shows:

...
  "ARGV" => array:2 [
    0 => "vendor/liuggio/fastest/fastest"
    1 => "XDEBUG_MODE=coverage bin/phpunit {} --coverage-php cov/fastest/{n}.cov;"
  ]
  "ARGC" => 2

Possible Solution

# Process.php:343
if (false !== $v && false === \in_array(strtolower($k), ['argc', 'argv'], true)) {

Additional Context

No response

@rbaarsma rbaarsma added the Bug label Dec 9, 2021
fabpot added a commit that referenced this issue Dec 11, 2021
…pped (rbaarsma)

This PR was submitted for the 5.4 branch but it was squashed and merged into the 4.4 branch instead.

Discussion
----------

[Process] fixed uppercase ARGC and ARGV should also be skipped

| Q             | A
| ------------- | ---
| Branch?       | 5.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #44534
| License       | MIT
| Doc PR        | no

uppercase env ARGC and ARGV were showing a warning:
```
[09-Dec-2021 17:17:05 Europe/Amsterdam] PHP Warning:  Array to string conversion in /var/www/app/vendor/symfony/process/Process.php on line 344
```

This PR fixes that by adding upon the existing functionality blocking argv and argc env vars to become part of the eventual env vars.

Commits
-------

0ced90c [Process] fixed uppercase ARGC and ARGV should also be skipped
@fabpot fabpot closed this as completed Dec 11, 2021
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

3 participants