-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Process] ContextErrorException | Array to string conversion #25511
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
Comments
How can that happen? |
Apparently the filter only applies to values fetched from $_ENV but the argv array is already present in $env from the line |
Ok after some enquiry it seems we have a weird server behavior on our side that makes |
This issue just cropped up over here, same as OP, @nicolas-grekas There isn't any validation on what Reverting back to v3.4.1 fixes the issue for me. |
Hi, I have the same problem than @nanofelis, the getDefaultEnv() method preserves the "argc" & "argv" parameters from For me, the trick is as follow (radical) : private function getDefaultEnv()
{
$env = getenv();
foreach ($_ENV as $k => $v) {
if (is_string($v)) {
$env[$k] = $v;
} else {
unset($env[$k]);
}
}
return $env;
} What is the "good way" to avoid this problem ? Nicolas |
Alrighty then. This is a bit weird. If a script accesses In my case this is actually caused because of a composer file include in Here's smallest (well, not codegolf small :P) piece of code to reproduce it: <?php
var_dump(getenv());
function notcalled()
{
$_SERVER['argv'];
} |
Thanks for the hints. Fixed by #25559 |
this should probably be reported as a bug to PHP though |
…roduce subtle breaks accros PHP versions (nicolas-grekas) This PR was merged into the 3.3 branch. Discussion ---------- [Process] Dont use getenv(), it returns arrays and can introduce subtle breaks accros PHP versions | Q | A | ------------- | --- | Branch? | 3.3 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #25511 | License | MIT | Doc PR | - Commits ------- 0d4bce6 [Process] Dont use getenv(), it returns arrays and can introduce subtle breaks accros PHP versions
Following @stof's comment I filed this https://bugs.php.net/bug.php?id=75712 Thanks for the fix @nicolas-grekas, do you know when it will be tagged? |
Environnement variables passed to
proc_open()
in https://github.com/symfony/symfony/blob/v3.4.2/src/Symfony/Component/Process/Process.php#L334 throw aContextErrorException "Array to string conversion"
The reason seems to be that env vars are now always inherited v3.4.1...v3.4.2#diff-f9f2411040cda7b73402481facf3e4dd
but if a query string is present in the url then $env contains
argv
as an arrayand apparently
proc_open()
does not expect a multi dimensionnal array for this parameter.The text was updated successfully, but these errors were encountered: