Skip to content

Commit

Permalink
bug #57815 [Console][PhpUnitBridge][VarDumper] Fix NO_COLOR empty v…
Browse files Browse the repository at this point in the history
…alue handling (alexandre-daubois)

This PR was merged into the 5.4 branch.

Discussion
----------

[Console][PhpUnitBridge][VarDumper] Fix `NO_COLOR` empty value handling

| Q             | A
| ------------- | ---
| Branch?       | 5.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        | symfony/symfony#57777 (comment)
| License       | MIT

`NO_COLOR` must be non-empty in order to be considered enabled (https://no-color.org/):

> when present and not an empty string (regardless of its value)

Commits
-------

6a96ff9116 [Console][PhpUnitBridge][VarDumper] Fix `NO_COLOR` empty value handling
  • Loading branch information
nicolas-grekas committed Jul 26, 2024
2 parents e4de722 + e0a521e commit 0c17c56
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Dumper/CliDumper.php
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ private function hasColorSupport($stream): bool
}

// Follow https://no-color.org/
if (isset($_SERVER['NO_COLOR']) || false !== getenv('NO_COLOR')) {
if ('' !== ($_SERVER['NO_COLOR'] ?? getenv('NO_COLOR') ?: '')) {
return false;
}

Expand Down

0 comments on commit 0c17c56

Please # to comment.