From 984b05cc9d7aafee7fd14001bd243870acdc2971 Mon Sep 17 00:00:00 2001 From: Arnaud Le Blanc Date: Mon, 8 Apr 2024 15:19:48 +0200 Subject: [PATCH] Fix tests when stdout is unbuffered --- ext/opcache/tests/issue0115.phpt | 8 +++++++- ext/opcache/tests/issue0149.phpt | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/ext/opcache/tests/issue0115.phpt b/ext/opcache/tests/issue0115.phpt index 5e32e1f6fb66d..c31f72e8c63b0 100644 --- a/ext/opcache/tests/issue0115.phpt +++ b/ext/opcache/tests/issue0115.phpt @@ -33,7 +33,13 @@ $p->setStub($stub); unset($p); include "php_cli_server.inc"; -php_cli_server_start('-d opcache.enable=1 -d opcache.enable_cli=1 -d extension=phar.'.PHP_SHLIB_SUFFIX); + +$ini = '-d opcache.enable=1 -d opcache.enable_cli=1'; +if (file_exists(ini_get('extension_dir').'/phar.'.PHP_SHLIB_SUFFIX)) { + $ini .= ' -d extension=phar.'.PHP_SHLIB_SUFFIX; +} +php_cli_server_start($ini); + echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/issue0115_1.phar.php'); echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/issue0115_2.phar.php'); ?> diff --git a/ext/opcache/tests/issue0149.phpt b/ext/opcache/tests/issue0149.phpt index a72a4bc4ee650..29e6f02808a75 100644 --- a/ext/opcache/tests/issue0149.phpt +++ b/ext/opcache/tests/issue0149.phpt @@ -21,7 +21,13 @@ $p->setStub($stub); unset($p); include "php_cli_server.inc"; -php_cli_server_start('-d opcache.enable=1 -d opcache.enable_cli=1 -d extension=phar.'.PHP_SHLIB_SUFFIX); + +$ini = '-d opcache.enable=1 -d opcache.enable_cli=1'; +if (file_exists(ini_get('extension_dir').'/phar.'.PHP_SHLIB_SUFFIX)) { + $ini .= ' -d extension=phar.'.PHP_SHLIB_SUFFIX; +} +php_cli_server_start($ini); + echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/issue0149.phar.php'); echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/issue0149.phar.php'); echo file_get_contents('http://' . PHP_CLI_SERVER_ADDRESS . '/issue0149.phar.php');