Skip to content

Commit 93c9a82

Browse files
Merge branch '6.4' into 7.0
* 6.4: Skip Twig v3.9-dev for now [Validator] Update Dutch (nl) translation Update Albanian translations [Validator] Update translation [FrameworkBundle] Prevent silenced warning by checking if /proc/mount exists [VarDumper][PhpUnitBridge] Fix color detection prevent throwing NOT_FOUND error when tube is empty [Validator] Update missing validator translation for Swedish [FrameworkBundle] Fix eager-loading of env vars in ConfigBuilderCacheWarmer [Messenger] Fix failing Redis test [Validator] Update Italian (it) translations [Validator] Missing translations for Hungarian (hu) #53769 revert to native PHP union types [Validator] Missing translations for Russian (ru) #53775 fix syntax errors on PHP 7
2 parents 0a2eeb0 + 5f3e4ab commit 93c9a82

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

DeprecationErrorHandler.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -400,29 +400,29 @@ private static function hasColorSupport(): bool
400400
return false;
401401
}
402402

403-
if ('Hyper' === getenv('TERM_PROGRAM')) {
403+
// Detect msysgit/mingw and assume this is a tty because detection
404+
// does not work correctly, see https://github.com/composer/composer/issues/9690
405+
if (!@stream_isatty($stream) && !\in_array(strtoupper((string) getenv('MSYSTEM')), ['MINGW32', 'MINGW64'], true)) {
404406
return true;
405407
}
406408

407-
if (\DIRECTORY_SEPARATOR === '\\') {
408-
return (\function_exists('sapi_windows_vt100_support')
409-
&& sapi_windows_vt100_support(\STDOUT))
410-
|| false !== getenv('ANSICON')
411-
|| 'ON' === getenv('ConEmuANSI')
412-
|| 'xterm' === getenv('TERM');
409+
if ('\\' === \DIRECTORY_SEPARATOR && @sapi_windows_vt100_support(\STDOUT)) {
410+
return true;
413411
}
414412

415-
if (\function_exists('stream_isatty')) {
416-
return @stream_isatty(\STDOUT);
413+
if ('Hyper' === getenv('TERM_PROGRAM')
414+
|| false !== getenv('COLORTERM')
415+
|| false !== getenv('ANSICON')
416+
|| 'ON' === getenv('ConEmuANSI')
417+
) {
418+
return true;
417419
}
418420

419-
if (\function_exists('posix_isatty')) {
420-
return @posix_isatty(\STDOUT);
421+
if ('dumb' === $term = (string) getenv('TERM')) {
422+
return false;
421423
}
422424

423-
$stat = fstat(\STDOUT);
424-
425-
// Check if formatted mode is S_IFCHR
426-
return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
425+
// See https://github.com/chalk/supports-color/blob/d4f413efaf8da045c5ab440ed418ef02dbb28bf1/index.js#L157
426+
return preg_match('/^((screen|xterm|vt100|vt220|putty|rxvt|ansi|cygwin|linux).*)|(.*-256(color)?(-bce)?)$/', $term);
427427
}
428428
}

0 commit comments

Comments
 (0)