diff --git a/Makefile b/Makefile index 3f5509e6d..78f82385a 100644 --- a/Makefile +++ b/Makefile @@ -212,6 +212,7 @@ e2e_php_settings_checker: docker-images fixtures/php-settings-checker/output-xde $(BOX_COMPILE) \ | grep '\[debug\]' \ | tee fixtures/php-settings-checker/actual-output || true + $(SED) "s/Xdebug/xdebug/" fixtures/php-settings-checker/actual-output diff fixtures/php-settings-checker/output-all-clear fixtures/php-settings-checker/actual-output @echo "$(CCYELLOW)Xdebug enabled: restart needed$(CCEND)" @@ -220,6 +221,7 @@ e2e_php_settings_checker: docker-images fixtures/php-settings-checker/output-xde $(BOX_COMPILE) \ | grep '\[debug\]' \ | tee fixtures/php-settings-checker/actual-output || true + $(SED) "s/Xdebug/xdebug/" fixtures/php-settings-checker/actual-output $(SED) "s/[0-9]* ms/100 ms/" fixtures/php-settings-checker/actual-output diff fixtures/php-settings-checker/output-xdebug-enabled fixtures/php-settings-checker/actual-output @@ -229,6 +231,7 @@ e2e_php_settings_checker: docker-images fixtures/php-settings-checker/output-xde $(BOX_COMPILE) \ | grep '\[debug\]' \ | tee fixtures/php-settings-checker/actual-output || true + $(SED) "s/Xdebug/xdebug/" fixtures/php-settings-checker/actual-output $(SED) "s/'-c' '.*' '\.\/box'/'-c' '\/tmp-file' 'bin\/box'/" fixtures/php-settings-checker/actual-output $(SED) "s/[0-9]* ms/100 ms/" fixtures/php-settings-checker/actual-output diff fixtures/php-settings-checker/output-pharreadonly-enabled fixtures/php-settings-checker/actual-output @@ -239,6 +242,7 @@ e2e_php_settings_checker: docker-images fixtures/php-settings-checker/output-xde $(BOX_COMPILE) \ | grep '\[debug\]' \ | tee fixtures/php-settings-checker/actual-output || true + $(SED) "s/Xdebug/xdebug/" fixtures/php-settings-checker/actual-output $(SED) "s/'-c' '.*' '\.\/box'/'-c' '\/tmp-file' 'bin\/box'/" fixtures/php-settings-checker/actual-output $(SED) "s/[0-9]* ms/100 ms/" fixtures/php-settings-checker/actual-output diff fixtures/php-settings-checker/output-min-memory-limit fixtures/php-settings-checker/actual-output @@ -249,6 +253,7 @@ e2e_php_settings_checker: docker-images fixtures/php-settings-checker/output-xde $(BOX_COMPILE) \ | grep '\[debug\]' \ | tee fixtures/php-settings-checker/actual-output || true + $(SED) "s/Xdebug/xdebug/" fixtures/php-settings-checker/actual-output $(SED) "s/'-c' '.*' '\.\/box'/'-c' '\/tmp-file' 'bin\/box'/" fixtures/php-settings-checker/actual-output $(SED) "s/[0-9]* ms/100 ms/" fixtures/php-settings-checker/actual-output diff fixtures/php-settings-checker/output-set-memory-limit fixtures/php-settings-checker/actual-output diff --git a/composer.json b/composer.json index e3c496e77..23c82e39c 100644 --- a/composer.json +++ b/composer.json @@ -38,6 +38,8 @@ } }, + "minimum-stability": "dev", + "prefer-stable": true, "require": { "php": "^7.2", "ext-phar": "*", @@ -46,7 +48,7 @@ "composer/semver": "^1.5", "composer/xdebug-handler": "^1.3.2", "hoa/compiler": "^3.17", - "humbug/php-scoper": "^0.12", + "humbug/php-scoper": "^0.13", "justinrainbow/json-schema": "^5.2.9", "nikic/iter": "^2.0", "nikic/php-parser": "^4.2", @@ -68,7 +70,7 @@ "infection/infection": "^0.10", "mikey179/vfsstream": "^1.6", "phpunit/phpunit": "^8.1", - "symfony/phpunit-bridge": "^4.2" + "symfony/phpunit-bridge": "^4.2 || ^5.0" }, "suggest": { "ext-openssl": "To accelerate private key generation." diff --git a/requirement-checker/expected_terminal_diff b/requirement-checker/expected_terminal_diff index 965e2d056..f931cc242 100644 --- a/requirement-checker/expected_terminal_diff +++ b/requirement-checker/expected_terminal_diff @@ -24,11 +24,43 @@ > * > * @license MIT (c) Fabien Potencier > */ -122c129 +99c106 +< private static function hasVt100Support(): bool +--- +> private static function hasVt100Support() +101c108 +< return \function_exists('sapi_windows_vt100_support') && sapi_windows_vt100_support(fopen('php://stdout', 'w')); +--- +> return \function_exists('sapi_windows_vt100_support') && \sapi_windows_vt100_support(\fopen('php://stdout', 'wb')); +104,106d110 +< /** +< * Initializes dimensions using the output of an stty columns line. +< */ +127c131 +< private static function getConsoleMode(): ?array +--- +> private static function getConsoleMode() +135c139 < return [(int) $matches[2], (int) $matches[1]]; --- > return array((int) $matches[2], (int) $matches[1]); -146,149c153,156 +139a144,145 +> * +> * @return string|null +141c147 +< private static function getSttyColumns(): ?string +--- +> private static function getSttyColumns() +146c152,157 +< private static function readFromProcess(string $command): ?string +--- +> /** +> * @param string $command +> * +> * @return string|null +> */ +> private static function readFromProcess($command) +152,155c163,166 < $descriptorspec = [ < 1 => ['pipe', 'w'], < 2 => ['pipe', 'w'], @@ -38,7 +70,7 @@ > 1 => array('pipe', 'w'), > 2 => array('pipe', 'w'), > ); -151c158 +157c168 < $process = proc_open($command, $descriptorspec, $pipes, null, null, ['suppress_errors' => true]); --- > $process = proc_open($command, $descriptorspec, $pipes, null, null, array('suppress_errors' => true)); diff --git a/requirement-checker/src/Terminal.php b/requirement-checker/src/Terminal.php index a79807837..727366271 100644 --- a/requirement-checker/src/Terminal.php +++ b/requirement-checker/src/Terminal.php @@ -86,7 +86,9 @@ private static function initDimensions() // or [w, h] from "wxh" self::$width = (int) $matches[1]; self::$height = isset($matches[4]) ? (int) $matches[4] : (int) $matches[2]; - } elseif (self::hasSttyAvailable()) { + } elseif (!self::hasVt100Support() && self::hasSttyAvailable()) { + // only use stty on Windows if the terminal does not support vt100 (e.g. Windows 7 + git-bash) + // testing for stty in a Windows 10 vt100-enabled console will implicitly disable vt100 support on STDOUT self::initDimensionsUsingStty(); } elseif (null !== $dimensions = self::getConsoleMode()) { // extract [w, h] from "wxh" @@ -98,6 +100,14 @@ private static function initDimensions() } } + /** + * Returns whether STDOUT has vt100 support (some Windows 10+ configurations). + */ + private static function hasVt100Support() + { + return \function_exists('sapi_windows_vt100_support') && \sapi_windows_vt100_support(\fopen('php://stdout', 'wb')); + } + private static function initDimensionsUsingStty() { if ($sttyString = self::getSttyColumns()) { diff --git a/tests/Console/Command/CompileTest.php b/tests/Console/Command/CompileTest.php index 69b5dde5a..06bd9589a 100644 --- a/tests/Console/Command/CompileTest.php +++ b/tests/Console/Command/CompileTest.php @@ -2962,6 +2962,12 @@ private function normalizeDisplay(string $display): string $display ); + $display = str_replace( + 'Xdebug', + 'xdebug', + $display + ); + return DisplayNormalizer::removeTrailingSpaces($display); }