[php-src] PHP-8.4: {ext/standard,sapi/cli}/tests: pass TEST_PHP_EXTRA_ARGS to php

From: Date: Wed, 14 Oct 2026 17:44:24 +0000
Subject: [php-src] PHP-8.4: {ext/standard,sapi/cli}/tests: pass TEST_PHP_EXTRA_ARGS to php
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-142281@lists.php.net to get a copy of this message
Author: Michael Orlitzky (orlitzky) Committer: Gina Peter Banyard (Girgias) Date: 2026-10-14T18:34:08+01:00 Commit: https://github.com/php/php-src/commit/b9f41139cff9c98c5f1375aab8b6ff59b6d93b22 Raw diff: https://github.com/php/php-src/commit/b9f41139cff9c98c5f1375aab8b6ff59b6d93b22.diff {ext/standard,sapi/cli}/tests: pass TEST_PHP_EXTRA_ARGS to php Several of these tests fail to pass TEST_PHP_EXTRA_ARGS to the PHP binary they execute. This can lead to spurious failures when, for example, the system's INI file is incompatible with the just-built CLI php: ---- EXPECTED OUTPUT int(111) ---- ACTUAL OUTPUT Failed loading /usr/lib64/php8.2/lib64/opcache.so: /usr/lib64/php8.2/lib64/opcache.so: undefined symbol: _emalloc_32 int(111) ---- FAILED This commit adds TEST_PHP_EXTRA_ARGS to the "php" invocations that are missing them, allowing the user to run "run-tests.php -n" to work around the problem. Changed paths: M ext/standard/tests/file/bug60120.phpt M ext/standard/tests/ini_info/php_ini_loaded_file.phpt M sapi/cli/tests/016.phpt M sapi/cli/tests/bug65275.phpt M sapi/cli/tests/bug74600.phpt M sapi/cli/tests/bug78323.phpt Diff: diff --git a/ext/standard/tests/file/bug60120.phpt b/ext/standard/tests/file/bug60120.phpt index 65027982cf96..59d9606a94ec 100644 --- a/ext/standard/tests/file/bug60120.phpt +++ b/ext/standard/tests/file/bug60120.phpt @@ -14,7 +14,9 @@ if (PHP_OS_FAMILY === 'Windows') die('skip not for Windows'); error_reporting(E_ALL); $php = getenv('TEST_PHP_EXECUTABLE_ESCAPED'); -$cmd = $php . ' -r "\$in = file_get_contents(\'php://stdin\'); fwrite(STDOUT, \$in); fwrite(STDERR, \$in);"'; +$args = getenv('TEST_PHP_EXTRA_ARGS'); +$cmd = ' -r "\$in = file_get_contents(\'php://stdin\'); fwrite(STDOUT, \$in); fwrite(STDERR, \$in);"'; +$cmd = join(' ', [$php, $args, $cmd]); $descriptors = array(array('pipe', 'r'), array('pipe', 'w'), array('pipe', 'w')); $stdin = str_repeat('*', 2049 ); diff --git a/ext/standard/tests/ini_info/php_ini_loaded_file.phpt b/ext/standard/tests/ini_info/php_ini_loaded_file.phpt index 1fce24e67fe4..4e3085ba8653 100644 --- a/ext/standard/tests/ini_info/php_ini_loaded_file.phpt +++ b/ext/standard/tests/ini_info/php_ini_loaded_file.phpt @@ -2,15 +2,16 @@ php_ini_loaded_file() function --FILE-- <?php - $inifile = __DIR__.DIRECTORY_SEPARATOR.'loaded.ini'; + $inifile = escapeshellarg(__DIR__.DIRECTORY_SEPARATOR.'loaded.ini'); $php = getenv('TEST_PHP_EXECUTABLE_ESCAPED'); + $args = getenv('TEST_PHP_EXTRA_ARGS'); $code = '"var_dump(php_ini_loaded_file());"'; // No ini file - passthru($php.' -n -r '.$code); + passthru("$php $args -n -r $code"); // Specified ini file - passthru($php.' -c '.escapeshellarg($inifile).' -r '.$code); + passthru("$php $args -c $inifile -r $code"); ?> --EXPECTREGEX-- bool\(false\) diff --git a/sapi/cli/tests/016.phpt b/sapi/cli/tests/016.phpt index 544633f592f6..3c0aa56e44a2 100644 --- a/sapi/cli/tests/016.phpt +++ b/sapi/cli/tests/016.phpt @@ -12,6 +12,7 @@ if (readline_info('done') === NULL) { --FILE-- <?php $php = getenv('TEST_PHP_EXECUTABLE_ESCAPED'); +$args = getenv('TEST_PHP_EXTRA_ARGS'); // disallow console escape sequences that may break the output putenv('TERM=VT100'); @@ -56,7 +57,7 @@ EOT; foreach ($codes as $key => $code) { echo "\n--------------\nSnippet no. $key:\n--------------\n"; $code = escapeshellarg($code); - echo echo $code | $php -a, "\n"; + echo echo $code | $php $args -a, "\n"; } echo "\nDone\n"; diff --git a/sapi/cli/tests/bug65275.phpt b/sapi/cli/tests/bug65275.phpt index 9ccb165466ee..e9a326595c37 100644 --- a/sapi/cli/tests/bug65275.phpt +++ b/sapi/cli/tests/bug65275.phpt @@ -4,7 +4,8 @@ Bug #65275: Calling exit() in a shutdown function does not change the exit value <?php $php = getenv('TEST_PHP_EXECUTABLE_ESCAPED'); -exec($php . ' ' . escapeshellarg(__DIR__ . '/bug65275.inc'), $output, $exit_status); +$args = getenv('TEST_PHP_EXTRA_ARGS'); +exec($php . ' ' . $args . ' ' . escapeshellarg(__DIR__ . '/bug65275.inc'), $output, $exit_status); var_dump($exit_status); ?> diff --git a/sapi/cli/tests/bug74600.phpt b/sapi/cli/tests/bug74600.phpt index 01da61a06604..e52056d40a3f 100644 --- a/sapi/cli/tests/bug74600.phpt +++ b/sapi/cli/tests/bug74600.phpt @@ -8,6 +8,7 @@ if (substr(PHP_OS, 0, 3) == "WIN") die("skip non windows test"); --FILE-- <?php $php = getenv("TEST_PHP_EXECUTABLE_ESCAPED"); +$args = getenv("TEST_PHP_EXTRA_ARGS"); $ini_file = __DIR__ . "/bug74600.ini"; $ini_file_escaped = escapeshellarg($ini_file); file_put_contents($ini_file, <<<INI @@ -20,7 +21,7 @@ $desc = array( 2 => array("pipe", "w"), ); $pipes = array(); -$proc = proc_open("$php -c $ini_file_escaped -r 'echo \"okey\";'", $desc, $pipes); +$proc = proc_open("$php $args -c $ini_file_escaped -r 'echo \"okey\";'", $desc, $pipes); if (!$proc) { exit(1); } diff --git a/sapi/cli/tests/bug78323.phpt b/sapi/cli/tests/bug78323.phpt index d353281a0e86..c9799db9e559 100644 --- a/sapi/cli/tests/bug78323.phpt +++ b/sapi/cli/tests/bug78323.phpt @@ -7,6 +7,7 @@ include "skipif.inc"; --FILE-- <?php $php = getenv('TEST_PHP_EXECUTABLE_ESCAPED'); +$args = getenv('TEST_PHP_EXTRA_ARGS'); // There are 3 types of option errors: // 1 : in flags @@ -16,7 +17,7 @@ $php = getenv('TEST_PHP_EXECUTABLE_ESCAPED'); // colon in flags ob_start(); -passthru("$php -a:Z 2>&1", $exitCode); +passthru("$php $args -a:Z 2>&1", $exitCode); $output = ob_get_contents(); ob_end_clean(); @@ -28,7 +29,7 @@ echo $lines[0], "\n", // option not found ob_start(); -passthru("$php -Z 2>&1", $exitCode); +passthru("$php $args -Z 2>&1", $exitCode); $output = ob_get_contents(); ob_end_clean(); @@ -40,7 +41,7 @@ echo $lines[0], "\n", // no argument for option ob_start(); -passthru("$php --memory-limit=1G 2>&1", $exitCode); +passthru("$php $args --memory-limit=1G 2>&1", $exitCode); $output = ob_get_contents(); ob_end_clean(); @@ -52,7 +53,7 @@ echo $lines[0], "\n", // Successful execution ob_start(); -passthru("$php -dmemory-limit=1G -v", $exitCode); +passthru("$php $args -dmemory-limit=1G -v", $exitCode); $output = ob_get_contents(); ob_end_clean();

« previous php.cvs (#142281) next »