Skip to content

Commit f9db2cc

Browse files
Merge branch '5.4' into 6.4
* 5.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
2 parents fc65185 + 4074601 commit f9db2cc

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

Dumper/CliDumper.php

+19-8
Original file line numberDiff line numberDiff line change
@@ -624,19 +624,30 @@ private function hasColorSupport(mixed $stream): bool
624624
return false;
625625
}
626626

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

631-
if (\DIRECTORY_SEPARATOR === '\\') {
632-
return (\function_exists('sapi_windows_vt100_support')
633-
&& @sapi_windows_vt100_support($stream))
634-
|| false !== getenv('ANSICON')
635-
|| 'ON' === getenv('ConEmuANSI')
636-
|| 'xterm' === getenv('TERM');
633+
if ('\\' === \DIRECTORY_SEPARATOR && @sapi_windows_vt100_support($stream)) {
634+
return true;
635+
}
636+
637+
if ('Hyper' === getenv('TERM_PROGRAM')
638+
|| false !== getenv('COLORTERM')
639+
|| false !== getenv('ANSICON')
640+
|| 'ON' === getenv('ConEmuANSI')
641+
) {
642+
return true;
643+
}
644+
645+
if ('dumb' === $term = (string) getenv('TERM')) {
646+
return false;
637647
}
638648

639-
return stream_isatty($stream);
649+
// See https://github.com/chalk/supports-color/blob/d4f413efaf8da045c5ab440ed418ef02dbb28bf1/index.js#L157
650+
return preg_match('/^((screen|xterm|vt100|vt220|putty|rxvt|ansi|cygwin|linux).*)|(.*-256(color)?(-bce)?)$/', $term);
640651
}
641652

642653
/**

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"symfony/http-kernel": "^5.4|^6.0|^7.0",
2828
"symfony/process": "^5.4|^6.0|^7.0",
2929
"symfony/uid": "^5.4|^6.0|^7.0",
30-
"twig/twig": "^2.13|^3.0.4"
30+
"twig/twig": "^2.13|~3.8.0"
3131
},
3232
"conflict": {
3333
"symfony/console": "<5.4"

0 commit comments

Comments
 (0)