[php-src] PHP-8.6: ext/standard/tests: pass TEST_PHP_EXTRA_ARGS to some proc_open() tests
| From: | Michael Orlitzky via Gina Peter Banyard | Date: | Wed, 14 Oct 2026 17:44:24 +0000 |
| Subject: | [php-src] PHP-8.6: ext/standard/tests: pass TEST_PHP_EXTRA_ARGS to some proc_open() tests | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-142280@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/f93f92db37772fb5daa9adf33f99275d5e6cd525
Raw diff: https://github.com/php/php-src/commit/f93f92db37772fb5daa9adf33f99275d5e6cd525.diff
ext/standard/tests: pass TEST_PHP_EXTRA_ARGS to some proc_open() tests
Several of our proc_open() 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:
---- ACTUAL OUTPUT
array(1) {
[2]=>
resource(4) of type (stream)
}
string(123) "Failed loading /usr/lib64/php8.2/lib64/opcache.so:
/usr/lib64/php8.2/lib64/opcache.so: undefined symbol: _emalloc_32
Error"
Naturally we would like to pass TEST_PHP_EXTRA_ARGS to these
invocations, after which "run-tests.php -n" would avoid loading the
incompatible INI file. However, in this case, TEST_PHP_EXTRA_ARGS is a
free-form environment variable, and proc_open() is being fed an array
of arguments. It would be difficult to parse TEST_PHP_EXTRA_ARGS into
an array, so we first convert the command-line array to a string,
and then afterwards simply append the extra args.
Changed paths:
M ext/standard/tests/general_functions/proc_open_null.phpt
M ext/standard/tests/general_functions/proc_open_redirect.phpt
M ext/standard/tests/general_functions/proc_open_sockets1.phpt
M ext/standard/tests/general_functions/proc_open_sockets2.phpt
M ext/standard/tests/general_functions/proc_open_sockets3.phpt
Diff:
diff --git a/ext/standard/tests/general_functions/proc_open_null.phpt
b/ext/standard/tests/general_functions/proc_open_null.phpt
index 097d4d2892ed..f5ea603f04b8 100644
--- a/ext/standard/tests/general_functions/proc_open_null.phpt
+++ b/ext/standard/tests/general_functions/proc_open_null.phpt
@@ -4,7 +4,8 @@ Null pipes in proc_open()
<?php
$php = getenv('TEST_PHP_EXECUTABLE');
-$cmd = [$php, '-r', 'echo "Test"; fprintf(STDERR,
"Error");'];
+$args = getenv('TEST_PHP_EXTRA_ARGS');
+$cmd = "$php $args -r 'echo \"Test\"; fprintf(STDERR,
\"Error\");'";
$proc = proc_open($cmd, [1 => ['null'], 2 => ['pipe', 'w']],
$pipes);
var_dump($pipes);
diff --git a/ext/standard/tests/general_functions/proc_open_redirect.phpt
b/ext/standard/tests/general_functions/proc_open_redirect.phpt
index 76940b715d8b..c8d29e894776 100644
--- a/ext/standard/tests/general_functions/proc_open_redirect.phpt
+++ b/ext/standard/tests/general_functions/proc_open_redirect.phpt
@@ -4,26 +4,29 @@ Redirection support in proc_open
<?php
$php = getenv('TEST_PHP_EXECUTABLE');
+$args = getenv('TEST_PHP_EXTRA_ARGS');
+$cmd = "$php $args";
+
try {
- proc_open([$php], [['redirect']], $pipes);
+ proc_open($cmd, [['redirect']], $pipes);
} catch (ValueError $exception) {
echo $exception->getMessage() . "\n";
}
try {
- proc_open([$php], [['redirect', 'foo']], $pipes);
+ proc_open($cmd, [['redirect', 'foo']], $pipes);
} catch (ValueError $exception) {
echo $exception->getMessage() . "\n";
}
try {
- proc_open([$php], [['redirect', 42]], $pipes);
+ proc_open($cmd, [['redirect', 42]], $pipes);
} catch (ValueError $exception) {
echo $exception->getMessage() . "\n";
}
echo "\nWith pipe:\n";
-$cmd = [$php, '-r', 'echo "Test\n"; fprintf(STDERR,
"Error");'];
+$cmd = "$php $args -r 'echo \"Test\n\"; fprintf(STDERR,
\"Error\");'";
$proc = proc_open($cmd, [1 => ['pipe', 'w'], 2 => ['redirect',
1]], $pipes);
var_dump($pipes);
var_dump(stream_get_contents($pipes[1]));
diff --git a/ext/standard/tests/general_functions/proc_open_sockets1.phpt
b/ext/standard/tests/general_functions/proc_open_sockets1.phpt
index ce5cca9491ed..19608fb606ee 100644
--- a/ext/standard/tests/general_functions/proc_open_sockets1.phpt
+++ b/ext/standard/tests/general_functions/proc_open_sockets1.phpt
@@ -7,10 +7,9 @@ if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
--FILE--
<?php
-$cmd = [
- getenv("TEST_PHP_EXECUTABLE"),
- __DIR__ . '/proc_open_sockets1.inc'
-];
+$php = getenv("TEST_PHP_EXECUTABLE");
+$args = getenv("TEST_PHP_EXTRA_ARGS");
+$cmd = "$php $args " . __DIR__ . '/proc_open_sockets1.inc';
$spec = [
['null'],
diff --git a/ext/standard/tests/general_functions/proc_open_sockets2.phpt
b/ext/standard/tests/general_functions/proc_open_sockets2.phpt
index 2fd705e90162..06b2c1aa6a4f 100644
--- a/ext/standard/tests/general_functions/proc_open_sockets2.phpt
+++ b/ext/standard/tests/general_functions/proc_open_sockets2.phpt
@@ -34,10 +34,9 @@ function write_pipe($pipe, $data)
}
}
-$cmd = [
- getenv("TEST_PHP_EXECUTABLE"),
- __DIR__ . '/proc_open_sockets2.inc'
-];
+$php = getenv("TEST_PHP_EXECUTABLE");
+$args = getenv("TEST_PHP_EXTRA_ARGS");
+$cmd = "$php $args " . __DIR__ . '/proc_open_sockets2.inc';
$spec = [
['socket'],
diff --git a/ext/standard/tests/general_functions/proc_open_sockets3.phpt
b/ext/standard/tests/general_functions/proc_open_sockets3.phpt
index 39569595d3a1..09eb3ebac2ad 100644
--- a/ext/standard/tests/general_functions/proc_open_sockets3.phpt
+++ b/ext/standard/tests/general_functions/proc_open_sockets3.phpt
@@ -25,10 +25,9 @@ function read_pipe($pipe): string
return $chunk;
}
-$cmd = [
- getenv("TEST_PHP_EXECUTABLE"),
- __DIR__ . '/proc_open_sockets2.inc'
-];
+$php = getenv("TEST_PHP_EXECUTABLE");
+$args = getenv("TEST_PHP_EXTRA_ARGS");
+$cmd = "$php $args " . __DIR__ . '/proc_open_sockets2.inc';
$spec = [
['pipe', 'r'],