bug #25972 support sapi_windows_vt100_support for php 7.2+ (jhdxr)

This PR was merged into the 2.7 branch.

Discussion
----------

support sapi_windows_vt100_support for php 7.2+

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | See below
| License       | MIT
| Doc PR        | N/A

php 7.2 enabled color support on windows(>=10.0.10586) and introduced a new function called `sapi_windows_vt100_support` to get and set the state. this PR add the support for this new function, so users on windows can see the colorful world again with php 7.2+.

Commits
-------

5bbb77b support sapi_windows_vt100_support for php 7.2+
This commit is contained in:
Nicolas Grekas 2018-01-31 10:06:53 +01:00
commit 1c58dcf949
3 changed files with 6 additions and 3 deletions

View File

@ -161,7 +161,8 @@ class DeprecationErrorHandler
{
if ('\\' === DIRECTORY_SEPARATOR) {
return
'10.0.10586' === PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD
defined('STDOUT') && function_exists('sapi_windows_vt100_support') && sapi_windows_vt100_support(STDOUT)
|| '10.0.10586' === PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD
|| false !== getenv('ANSICON')
|| 'ON' === getenv('ConEmuANSI')
|| 'xterm' === getenv('TERM');

View File

@ -90,7 +90,8 @@ class StreamOutput extends Output
{
if (DIRECTORY_SEPARATOR === '\\') {
return
'10.0.10586' === PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD
function_exists('sapi_windows_vt100_support') && sapi_windows_vt100_support($this->stream)
|| '10.0.10586' === PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD
|| false !== getenv('ANSICON')
|| 'ON' === getenv('ConEmuANSI')
|| 'xterm' === getenv('TERM');

View File

@ -450,7 +450,8 @@ class CliDumper extends AbstractDumper
if ('\\' === DIRECTORY_SEPARATOR) {
static::$defaultColors = @(
'10.0.10586' === PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD
function_exists('sapi_windows_vt100_support') && sapi_windows_vt100_support($this->outputStream)
|| '10.0.10586' === PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD
|| false !== getenv('ANSICON')
|| 'ON' === getenv('ConEmuANSI')
|| 'xterm' === getenv('TERM')