Skip to content

Commit 49b7764

Browse files
[Console][PhpUnitBridge][VarDumper] Fix NO_COLOR empty value handling
1 parent 8fea773 commit 49b7764

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

DeprecationErrorHandler.php

+1-1
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 (isset($_SERVER['NO_COLOR']) || false !== getenv('NO_COLOR')) {
413+
if ('' !== ($_SERVER['NO_COLOR'] ?? getenv('NO_COLOR') ?: '')) {
414414
return false;
415415
}
416416

bin/simple-phpunit.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ class_exists(\SymfonyExcludeListSimplePhpunit::class, false) && PHPUnit\Util\Bla
368368
}
369369
}
370370

371-
$cmd[0] = sprintf('%s %s --colors=%s', $PHP, escapeshellarg("$PHPUNIT_DIR/$PHPUNIT_VERSION_DIR/phpunit"), false === $getEnvVar('NO_COLOR') ? 'always' : 'never');
371+
$cmd[0] = sprintf('%s %s --colors=%s', $PHP, escapeshellarg("$PHPUNIT_DIR/$PHPUNIT_VERSION_DIR/phpunit"), '' === $getEnvVar('NO_COLOR', '') ? 'always' : 'never');
372372
$cmd = str_replace('%', '%%', implode(' ', $cmd)).' %1$s';
373373

374374
if ('\\' === \DIRECTORY_SEPARATOR) {
@@ -458,7 +458,7 @@ class SymfonyExcludeListSimplePhpunit
458458
{
459459
}
460460
}
461-
array_splice($argv, 1, 0, ['--colors='.(false === $getEnvVar('NO_COLOR') ? 'always' : 'never')]);
461+
array_splice($argv, 1, 0, ['--colors='.('' === $getEnvVar('NO_COLOR', '') ? 'always' : 'never')]);
462462
$_SERVER['argv'] = $argv;
463463
$_SERVER['argc'] = ++$argc;
464464
include "$PHPUNIT_DIR/$PHPUNIT_VERSION_DIR/phpunit";

0 commit comments

Comments
 (0)