Skip to content

Commit faa8ebd

Browse files
bug #57997 [Console][PhpUnitBridge][VarDumper] Fix handling NO_COLOR env var (nicolas-grekas)
This PR was merged into the 5.4 branch. Discussion ---------- [Console][PhpUnitBridge][VarDumper] Fix handling NO_COLOR env var | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | - | License | MIT https://no-color.org/ stipulates that only the empty string should be considered as false. The current code also accepts `0` erroneously. Commits ------- 4ae8384 [PhpUnitBridge][Console][VarDumper] Fix handling NO_COLOR env var
2 parents 0ae7140 + 4ae8384 commit faa8ebd

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ private static function hasColorSupport()
410410
}
411411

412412
// Follow https://no-color.org/
413-
if ('' !== ($_SERVER['NO_COLOR'] ?? getenv('NO_COLOR') ?: '')) {
413+
if ('' !== (($_SERVER['NO_COLOR'] ?? getenv('NO_COLOR'))[0] ?? '')) {
414414
return false;
415415
}
416416

src/Symfony/Component/Console/Output/StreamOutput.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ protected function doWrite(string $message, bool $newline)
9191
protected function hasColorSupport()
9292
{
9393
// Follow https://no-color.org/
94-
if ('' !== ($_SERVER['NO_COLOR'] ?? getenv('NO_COLOR') ?: '')) {
94+
if ('' !== (($_SERVER['NO_COLOR'] ?? getenv('NO_COLOR'))[0] ?? '')) {
9595
return false;
9696
}
9797

src/Symfony/Component/VarDumper/Dumper/CliDumper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ private function hasColorSupport($stream): bool
606606
}
607607

608608
// Follow https://no-color.org/
609-
if ('' !== ($_SERVER['NO_COLOR'] ?? getenv('NO_COLOR') ?: '')) {
609+
if ('' !== (($_SERVER['NO_COLOR'] ?? getenv('NO_COLOR'))[0] ?? '')) {
610610
return false;
611611
}
612612

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy