Skip to content

Commit 6806003

Browse files
minor #33878 [Console] Replace posix_isatty with cross-platform, always available stream_isatty (ostrolucky)
This PR was merged into the 5.0-dev branch. Discussion ---------- [Console] Replace posix_isatty with cross-platform, always available stream_isatty | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR | stream_isatty is always available since PHP 7.2, which is the minimal version required for Symfony 5.0, so we can remove usages of old, not cross-platform compatible `posix_isatty` DeprecationErrorHandler left out, since AFAIK it's still meant to be compatible with PHP 5.5 Commits ------- c9b8b046a7 Replace posix_isatty with cross-platform, always available stream_isatty
2 parents f47ea48 + 1c0916f commit 6806003

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

Dumper/CliDumper.php

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -587,17 +587,7 @@ private function hasColorSupport($stream): bool
587587
|| 'xterm' === getenv('TERM');
588588
}
589589

590-
if (\function_exists('stream_isatty')) {
591-
return @stream_isatty($stream);
592-
}
593-
594-
if (\function_exists('posix_isatty')) {
595-
return @posix_isatty($stream);
596-
}
597-
598-
$stat = @fstat($stream);
599-
// Check if formatted mode is S_IFCHR
600-
return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
590+
return stream_isatty($stream);
601591
}
602592

603593
/**

0 commit comments

Comments
 (0)