minor #25168 [HttpKernel] don't override existing verbosity env var (xabbuh)

This PR was merged into the 3.4 branch.

Discussion
----------

[HttpKernel] don't override existing verbosity env var

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

While playing with the changes from #25162 I noticed that setting the `SHELL_VERBOSITY` env var in `phpunit.xml.dist` did not work as the kernel was setting the variable before the logic in the `Logger` class was executed.

Commits
-------

df4d6d6 don't override existing verbosity env var
This commit is contained in:
Nicolas Grekas 2017-11-27 09:12:26 +01:00
commit 4cfd2d90a5

View File

@ -120,7 +120,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
return;
}
if ($this->debug && !isset($_SERVER['SHELL_VERBOSITY'])) {
if ($this->debug && !isset($_ENV['SHELL_VERBOSITY']) && !isset($_SERVER['SHELL_VERBOSITY'])) {
putenv('SHELL_VERBOSITY=3');
$_ENV['SHELL_VERBOSITY'] = 3;
$_SERVER['SHELL_VERBOSITY'] = 3;