|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2020-07-07 15:14 UTC] 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.
PatchesPull Requests
Pull requests:
HistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 11:00:01 2025 UTC |
It appears to be deliberate in the sense that the problem was classified as a sort of "type error" and was thus updated to throw actual TypeErrors. Quickly scanning over the source, the logic for whether that exception is thrown is also used with whether stream_isatty() returns true. Thus I would suggest a change like if (\DIRECTORY_SEPARATOR === '\\') { return (\function_exists('sapi_windows_vt100_support') + && stream_isatty($this->stream) - && @sapi_windows_vt100_support($this->stream)) + && sapi_windows_vt100_support($this->stream)) || false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI') || 'xterm' === getenv('TERM'); } Before I found stream_isatty() I would have agreed that a warning is more appropriate, but now I'm not so sure. Either way, I think the docs for sapi_windows_vt100_support() should mention stream_isatty() too.