Skip to content

Commit 02e5c67

Browse files
bug symfony#25869 [Process] Skip environment variables with false value in Process (francoispluchino)
This PR was merged into the 3.3 branch. Discussion ---------- [Process] Skip environment variables with false value in Process | Q | A | ------------- | --- | Branch? | master, 4.0, 3.3, 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | ~ | License | MIT | Doc PR | ~ With the commit 03adce2, all env variables are injecting in the process, and the env variable with the `false` value are converted in empty string. For example, it's problematic with the bundle SymfonyWebServerBundle and the last version of the [symfony/framework-bundle recipe](https://github.com/symfony/recipes/blob/master/symfony/framework-bundle/3.3/public/index.php#L11), because the WebServer override the value of `APP_ENV` with `false` to override previously loaded variables (c5a1218), and with the commit 03adce2, the `APP_ENV` variable is injected with a empty string value, instead of not being injected, as was the case before. This PR not use the same logic as the [getDefaultEnv()](https://github.com/symfony/symfony/blob/4.0/src/Symfony/Component/Process/Process.php#L1553) method. Commits ------- 2daf4f9 [Process] Skip environment variables with false value in Process
2 parents 7d8577b + 2daf4f9 commit 02e5c67

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Symfony/Component/Process/Process.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,9 @@ public function start(callable $callback = null/*, array $env = array()*/)
331331
} else {
332332
$envPairs = array();
333333
foreach ($env as $k => $v) {
334-
$envPairs[] = $k.'='.$v;
334+
if (false !== $v) {
335+
$envPairs[] = $k.'='.$v;
336+
}
335337
}
336338
}
337339

0 commit comments

Comments
 (0)