summaryrefslogtreecommitdiff
path: root/vendor/symfony/polyfill-php72/Php72.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/symfony/polyfill-php72/Php72.php')
-rw-r--r--vendor/symfony/polyfill-php72/Php72.php30
1 files changed, 29 insertions, 1 deletions
diff --git a/vendor/symfony/polyfill-php72/Php72.php b/vendor/symfony/polyfill-php72/Php72.php
index 5925c1b9ab..39f144caa3 100644
--- a/vendor/symfony/polyfill-php72/Php72.php
+++ b/vendor/symfony/polyfill-php72/Php72.php
@@ -39,7 +39,7 @@ final class Php72
public static function utf8_decode($s)
{
- $s .= '';
+ $s = (string) $s;
$len = strlen($s);
for ($i = 0, $j = 0; $i < $len; ++$i, ++$j) {
@@ -95,6 +95,34 @@ final class Php72
return self::$hashMask ^ hexdec(substr($hash, 16 - \PHP_INT_SIZE, \PHP_INT_SIZE));
}
+ public static function sapi_windows_vt100_support($stream, $enable = null)
+ {
+ // We cannot actually disable vt100 support if it is set
+ if (false === $enable || !self::stream_isatty($stream)) {
+ return false;
+ }
+
+ // The native function does not apply to stdin
+ $meta = array_map('strtolower', stream_get_meta_data($stream));
+ $stdin = 'php://stdin' === $meta['uri'] || 'php://fd/0' === $meta['uri'];
+
+ return !$stdin
+ && (false !== getenv('ANSICON')
+ || 'ON' === getenv('ConEmuANSI')
+ || 'xterm' === getenv('TERM'));
+ }
+
+ public static function stream_isatty($stream)
+ {
+ if ('\\' === DIRECTORY_SEPARATOR) {
+ $stat = @fstat($stream);
+ // Check if formatted mode is S_IFCHR
+ return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
+ }
+
+ return function_exists('posix_isatty') && @posix_isatty($stream);
+ }
+
private static function initHashMask()
{
$obj = (object) array();