Skip to content

Commit

Permalink
Merge branch '5.4' into 6.4
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
nicolas-grekas committed Feb 7, 2024
2 parents fc65185 + 4074601 commit f9db2cc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
27 changes: 19 additions & 8 deletions Dumper/CliDumper.php
Original file line number Diff line number Diff line change
Expand Up @@ -624,19 +624,30 @@ private function hasColorSupport(mixed $stream): bool
return false;
}

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

if (\DIRECTORY_SEPARATOR === '\\') {
return (\function_exists('sapi_windows_vt100_support')
&& @sapi_windows_vt100_support($stream))
|| false !== getenv('ANSICON')
|| 'ON' === getenv('ConEmuANSI')
|| 'xterm' === getenv('TERM');
if ('\\' === \DIRECTORY_SEPARATOR && @sapi_windows_vt100_support($stream)) {
return true;
}

if ('Hyper' === getenv('TERM_PROGRAM')
|| false !== getenv('COLORTERM')
|| false !== getenv('ANSICON')
|| 'ON' === getenv('ConEmuANSI')
) {
return true;
}

if ('dumb' === $term = (string) getenv('TERM')) {
return false;
}

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

/**
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"symfony/http-kernel": "^5.4|^6.0|^7.0",
"symfony/process": "^5.4|^6.0|^7.0",
"symfony/uid": "^5.4|^6.0|^7.0",
"twig/twig": "^2.13|^3.0.4"
"twig/twig": "^2.13|~3.8.0"
},
"conflict": {
"symfony/console": "<5.4"
Expand Down

0 comments on commit f9db2cc

Please sign in to comment.