Bug #79805 [Com]: sapi_windows_vt100_support throws TypeError when not able to analyze the stream
Edit report at https://bugs.php.net/bug.php?id=79805&edit=1
ID: 79805
Comment by: nicolasgrekas@php.net
Reported by: ondrej at mirtes dot cz
Summary: sapi_windows_vt100_support throws TypeError when not
able to analyze the stream
Status: Open
Type: Bug
Package: Streams related
Operating System: Windows
PHP Version: 8.0.0alpha1
Block user comment: N
Private report: N
New Comment:
I may be missing something, but neither the warning nor the TypeError look legit to me.
The function should just return false instead IIUC.
Previous Comments:
------------------------------------------------------------------------
[2020-07-07 15:14:37] ondrej at mirtes dot cz
Description:
------------
Hi, Symfony Console contains this code:
if (\DIRECTORY_SEPARATOR === '\\') {
return (\function_exists('sapi_windows_vt100_support')
&& @sapi_windows_vt100_support($this->stream))
|| false !== getenv('ANSICON')
|| 'ON' === getenv('ConEmuANSI')
|| 'xterm' === getenv('TERM');
}
(https://github.com/symfony/symfony/blob/104a8f8cc99d49f15a67c3014e644740bc4d41d9/src/Symfony/Component/Console/Output/StreamOutput.php#L105-L111)
The @ is there because on PHP 7.x, the function throws this warning:
E_WARNING: sapi_windows_vt100_support() was not able to analyze the specified stream
In PHP 8, this is now a TypeError:
TypeError: sapi_windows_vt100_support() was not able to analyze the specified stream
I'm opening this bug to make sure that this changed is done on purpose (or not) so that the
code in Symfony can be fixed.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79805&edit=1
Thread (8 messages)