[php-src] PHP-8.6: Merge branch 'PHP-8.5' into PHP-8.6
| From: | Gina Peter Banyard | Date: | Wed, 14 Oct 2026 17:44:29 +0000 |
| Subject: | [php-src] PHP-8.6: Merge branch 'PHP-8.5' into PHP-8.6 | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-142286@lists.php.net to get a copy of this message | ||
Author: Gina Peter Banyard (Girgias)
Date: 2026-10-14T18:43:37+01:00
Commit: https://github.com/php/php-src/commit/3e458e5fdc7d41d2fc0dc09432ffe6c1cc8343f9
Raw diff: https://github.com/php/php-src/commit/3e458e5fdc7d41d2fc0dc09432ffe6c1cc8343f9.diff
Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5:
Update NEWS
ext/standard/tests: work around Windows quoting with tempfiles.
.github/scripts/windows: pass an extension_dir to the test runner.
{ext/standard,sapi/cli}/tests: pass TEST_PHP_EXTRA_ARGS to php
ext/standard/tests: pass TEST_PHP_EXTRA_ARGS to some proc_open() tests
sapi/cli/tests/023.phpt: support TEST_PHP_EXTRA_ARGS
std: Fix memory leak of the last response headers after a nested HTTP request (#24201)
Fiber: hold the object a callable resolved to in the creating frame (#24134)
Changed paths:
A Zend/tests/fibers/fiber-callable-object-outlives-caller.phpt
A ext/standard/tests/http/http_response_header_nested_request.phpt
M .github/scripts/windows/test_task.bat
M Zend/zend_fibers.c
M ext/standard/http_fopen_wrapper.c
M ext/standard/tests/file/bug60120.phpt
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
M ext/standard/tests/ini_info/php_ini_loaded_file.phpt
M sapi/cli/tests/016.phpt
M sapi/cli/tests/023.phpt
M sapi/cli/tests/bug65275.phpt
M sapi/cli/tests/bug74600.phpt
M sapi/cli/tests/bug78323.phpt
Diff:
diff --git a/.github/scripts/windows/test_task.bat b/.github/scripts/windows/test_task.bat
index 77b0059fccf4..186c40ed09a1 100644
--- a/.github/scripts/windows/test_task.bat
+++ b/.github/scripts/windows/test_task.bat
@@ -90,7 +90,10 @@ set OPENSSL_CONF=
rem set SSLEAY_CONF=
rem prepare for OPcache
-if "%OPCACHE%" equ "1" set OPCACHE_OPTS=-d opcache.enable=1 -d
opcache.enable_cli=1 -d opcache.protect_memory=1 -d opcache.jit_buffer_size=64M -d
opcache.jit=tracing
+set PHP_BUILD_DIR=%PHP_BUILD_OBJ_DIR%\Release
+if "%THREAD_SAFE%" equ "1" set PHP_BUILD_DIR=%PHP_BUILD_DIR%_TS
+
+if "%OPCACHE%" equ "1" set OPCACHE_OPTS=-d opcache.enable=1 -d
opcache.enable_cli=1 -d opcache.protect_memory=1 -d opcache.jit_buffer_size=64M -d
opcache.jit=tracing -d extension_dir=%PHP_BUILD_DIR%
rem prepare for enchant
mkdir %~d0\usr\local\lib\enchant-2
@@ -111,9 +114,6 @@ set MIBDIRS=%DEPS_DIR%\share\mibs
sed -i "s/exec HexTest .*/exec HexTest cscript\.exe \/nologo
%GITHUB_WORKSPACE:\=\/%\/ext\/snmp\/tests\/bigtest\.js/g"
%GITHUB_WORKSPACE%\ext\snmp\tests\snmpd.conf
start %DEPS_DIR%\bin\snmpd.exe -C -c %GITHUB_WORKSPACE%\ext\snmp\tests\snmpd.conf -Ln
-set PHP_BUILD_DIR=%PHP_BUILD_OBJ_DIR%\Release
-if "%THREAD_SAFE%" equ "1" set PHP_BUILD_DIR=%PHP_BUILD_DIR%_TS
-
rem prepare for mail
curl -sLo hMailServer.zip https://downloads.php.net/~windows/php-sdk/deps/vs18/x64/hmailserver-5.7.0-vs18-x64.zip
unzip -q hMailServer.zip -d hMailServer
diff --git a/Zend/tests/fibers/fiber-callable-object-outlives-caller.phpt
b/Zend/tests/fibers/fiber-callable-object-outlives-caller.phpt
new file mode 100644
index 000000000000..849bc7b6daa4
--- /dev/null
+++ b/Zend/tests/fibers/fiber-callable-object-outlives-caller.phpt
@@ -0,0 +1,85 @@
+--TEST--
+Fiber holds the object a callable resolved to in the creating method ($this for [A::class,
'm'] or "A::m")
+--FILE--
+<?php
+class A {
+ public ?Fiber $fiber = null;
+
+ public function __construct(public string $name) {}
+
+ public function m() {
+ echo "m on {$this->name}\n";
+ }
+
+ public function waits() {
+ Fiber::suspend();
+ echo "resumed on {$this->name}\n";
+ }
+
+ public function make(string $method) {
+ return new Fiber([A::class, $method]);
+ }
+
+ public function makeFromString() {
+ return new Fiber("A::m");
+ }
+
+ public function keep() {
+ $this->fiber = new Fiber([A::class, 'm']);
+ }
+
+ public function __destruct() {
+ echo "released {$this->name}\n";
+ }
+}
+
+echo "-- started after its creator's last reference went\n";
+$fiber = (new A("a1"))->make('m');
+$fiber->start();
+echo "after start\n";
+
+echo "-- a string callable\n";
+$fiber = (new A("a2"))->makeFromString();
+$fiber->start();
+echo "after start\n";
+
+echo "-- never started, released with the fiber\n";
+$fiber = (new A("a3"))->make('m');
+unset($fiber);
+echo "after unset\n";
+
+echo "-- suspended while its object has no other reference\n";
+$a = new A("a4");
+$fiber = $a->make('waits');
+$fiber->start();
+unset($a);
+$fiber->resume();
+echo "after resume\n";
+
+echo "-- a cycle through the fiber is collected\n";
+$a = new A("a5");
+$a->keep();
+unset($a);
+var_dump(gc_collect_cycles());
+echo "end\n";
+?>
+--EXPECT--
+-- started after its creator's last reference went
+m on a1
+released a1
+after start
+-- a string callable
+m on a2
+released a2
+after start
+-- never started, released with the fiber
+released a3
+after unset
+-- suspended while its object has no other reference
+resumed on a4
+released a4
+after resume
+-- a cycle through the fiber is collected
+released a5
+int(2)
+end
diff --git a/Zend/zend_fibers.c b/Zend/zend_fibers.c
index 40ce19d7a43c..dc8b3f609c68 100644
--- a/Zend/zend_fibers.c
+++ b/Zend/zend_fibers.c
@@ -563,6 +563,39 @@ static void zend_fiber_cleanup(zend_fiber_context *context)
fiber->caller = NULL;
}
+static void zend_fiber_addref_callable(zend_fiber *fiber)
+{
+ // Keep a reference to closures or callable objects while the fiber is running.
+ Z_TRY_ADDREF(fiber->fci.function_name);
+
+ /* For [A::class, 'm'] or "A::m" inside a method of A, fci.object is the
caller's $this. */
+ if (fiber->fci.object != NULL) {
+ GC_ADDREF(fiber->fci.object);
+ }
+}
+
+static void zend_fiber_get_gc_callable(zend_fiber *fiber, zend_get_gc_buffer *buf)
+{
+ zend_get_gc_buffer_add_zval(buf, &fiber->fci.function_name);
+
+ if (fiber->fci.object != NULL) {
+ zend_get_gc_buffer_add_obj(buf, fiber->fci.object);
+ }
+}
+
+static void zend_fiber_release_callable(zend_fiber *fiber)
+{
+ zval_ptr_dtor(&fiber->fci.function_name);
+ ZVAL_UNDEF(&fiber->fci.function_name);
+ fiber->fci_cache = empty_fcall_info_cache;
+
+ if (fiber->fci.object != NULL) {
+ zend_object *object = fiber->fci.object;
+ fiber->fci.object = NULL;
+ OBJ_RELEASE(object);
+ }
+}
+
static ZEND_STACK_ALIGNED void zend_fiber_execute(zend_fiber_transfer *transfer)
{
ZEND_ASSERT(Z_TYPE(transfer->value) == IS_NULL && "Initial transfer value to fiber
context must be NULL");
@@ -605,8 +638,7 @@ static ZEND_STACK_ALIGNED void zend_fiber_execute(zend_fiber_transfer *transfer)
zend_call_function(&fiber->fci, &fiber->fci_cache);
/* Cleanup callback and unset field to prevent GC / duplicate dtor issues. */
- zval_ptr_dtor(&fiber->fci.function_name);
- ZVAL_UNDEF(&fiber->fci.function_name);
+ zend_fiber_release_callable(fiber);
if (EG(exception)) {
if (!(fiber->flags & ZEND_FIBER_FLAG_DESTROYED)
@@ -808,7 +840,7 @@ static void zend_fiber_object_free(zend_object *object)
{
zend_fiber *fiber = (zend_fiber *) object;
- zval_ptr_dtor(&fiber->fci.function_name);
+ zend_fiber_release_callable(fiber);
zval_ptr_dtor(&fiber->result);
zend_object_std_dtor(&fiber->std);
@@ -819,7 +851,7 @@ static HashTable *zend_fiber_object_gc(zend_object *object, zval **table, int *n
zend_fiber *fiber = (zend_fiber *) object;
zend_get_gc_buffer *buf = zend_get_gc_buffer_create();
- zend_get_gc_buffer_add_zval(buf, &fiber->fci.function_name);
+ zend_fiber_get_gc_callable(fiber, buf);
zend_get_gc_buffer_add_zval(buf, &fiber->result);
if (fiber->context.status != ZEND_FIBER_STATUS_SUSPENDED || fiber->caller != NULL) {
@@ -887,8 +919,7 @@ ZEND_METHOD(Fiber, __construct)
fiber->fci = fci;
fiber->fci_cache = fcc;
- // Keep a reference to closures or callable objects while the fiber is running.
- Z_TRY_ADDREF(fiber->fci.function_name);
+ zend_fiber_addref_callable(fiber);
}
ZEND_METHOD(Fiber, start)
diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c
index cfe4e8e7a95b..1ca79b172259 100644
--- a/ext/standard/http_fopen_wrapper.c
+++ b/ext/standard/http_fopen_wrapper.c
@@ -1277,16 +1277,15 @@ php_stream *php_stream_url_wrap_http(php_stream_wrapper *wrapper, const char
*pa
ZVAL_UNDEF(&headers);
- zval_ptr_dtor(&BG(last_http_headers));
- ZVAL_UNDEF(&BG(last_http_headers));
-
stream = php_stream_url_wrap_http_ex(
wrapper, path, mode, options, opened_path, context,
PHP_URL_REDIRECT_MAX, HTTP_WRAPPER_HEADER_INIT, &headers STREAMS_CC);
- if (!Z_ISUNDEF(headers)) {
- ZVAL_COPY(&BG(last_http_headers), &headers);
+ /* After the request: one made from its notification callback may have stored its own headers
here. */
+ zval_ptr_dtor(&BG(last_http_headers));
+ ZVAL_COPY(&BG(last_http_headers), &headers);
+ if (!Z_ISUNDEF(headers)) {
if (FAILURE == zend_set_local_var_str(
"http_response_header", sizeof("http_response_header")-1, &headers, 0))
{
zval_ptr_dtor(&headers);
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/general_functions/proc_open_null.phpt
b/ext/standard/tests/general_functions/proc_open_null.phpt
index 097d4d2892ed..6c869725dd23 100644
--- a/ext/standard/tests/general_functions/proc_open_null.phpt
+++ b/ext/standard/tests/general_functions/proc_open_null.phpt
@@ -4,7 +4,10 @@ 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');
+$fn = tempnam(sys_get_temp_dir(), "PROC_OPEN_TEST");
+$cmd = "$php $args " . escapeshellarg($fn);
+file_put_contents($fn, '<?php echo "Test"; fprintf(STDERR,
"Error");');
$proc = proc_open($cmd, [1 => ['null'], 2 => ['pipe', 'w']],
$pipes);
var_dump($pipes);
@@ -15,16 +18,17 @@ $proc = proc_open($cmd, [1 => ['pipe', 'w'], 2 =>
['null']], $pipes);
var_dump($pipes);
var_dump(stream_get_contents($pipes[1]));
proc_close($proc);
+unlink($fn);
?>
--EXPECT--
array(1) {
[2]=>
- resource(4) of type (stream)
+ resource(6) of type (stream)
}
string(5) "Error"
array(1) {
[1]=>
- resource(6) of type (stream)
+ resource(8) of type (stream)
}
string(4) "Test"
diff --git a/ext/standard/tests/general_functions/proc_open_redirect.phpt
b/ext/standard/tests/general_functions/proc_open_redirect.phpt
index a3d185d04f75..d550d5da09f9 100644
--- a/ext/standard/tests/general_functions/proc_open_redirect.phpt
+++ b/ext/standard/tests/general_functions/proc_open_redirect.phpt
@@ -4,26 +4,31 @@ 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 (Throwable $exception) {
echo $exception::class, ': ', $exception->getMessage(), "\n";
}
try {
- proc_open([$php], [['redirect', 'foo']], $pipes);
+ proc_open($cmd, [['redirect', 'foo']], $pipes);
} catch (Throwable $exception) {
echo $exception::class, ': ', $exception->getMessage(), "\n";
}
try {
- proc_open([$php], [['redirect', 42]], $pipes);
+ proc_open($cmd, [['redirect', 42]], $pipes);
} catch (Throwable $exception) {
echo $exception::class, ': ', $exception->getMessage(), "\n";
}
echo "\nWith pipe:\n";
-$cmd = [$php, '-r', 'echo "Test\n"; fprintf(STDERR,
"Error");'];
+$fn = tempnam(sys_get_temp_dir(), "PROC_OPEN_TEST");
+file_put_contents($fn, '<?php echo "Test\n"; fprintf(STDERR,
"Error");');
+$cmd = "$php $args " . escapeshellarg($fn);
$proc = proc_open($cmd, [1 => ['pipe', 'w'], 2 => ['redirect',
1]], $pipes);
var_dump($pipes);
var_dump(stream_get_contents($pipes[1]));
@@ -49,6 +54,7 @@ unlink($fileName);
echo "\nWith inherited stdout:\n";
$proc = proc_open($cmd, [2 => ['redirect', 1]], $pipes);
proc_close($proc);
+unlink($fn);
?>
--EXPECTF--
@@ -60,7 +66,7 @@ Warning: proc_open(): Redirection target 42 not found in %s
With pipe:
array(1) {
[1]=>
- resource(4) of type (stream)
+ resource(6) of type (stream)
}
string(10) "Test
Error"
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'],
diff --git a/ext/standard/tests/http/http_response_header_nested_request.phpt
b/ext/standard/tests/http/http_response_header_nested_request.phpt
new file mode 100644
index 000000000000..d562818f74e1
--- /dev/null
+++ b/ext/standard/tests/http/http_response_header_nested_request.phpt
@@ -0,0 +1,41 @@
+--TEST--
+http_get_last_response_headers() after a request made from a notification callback
+--SKIPIF--
+<?php require 'server.inc'; http_server_skipif(); ?>
+--INI--
+allow_url_fopen=1
+--FILE--
+<?php
+require 'server.inc';
+
+$responses = [
+ "data://text/plain,HTTP/1.0 200 Ok\r\nContent-Type: text/plain\r\nOuter:
1\r\n\r\nouter",
+ "data://text/plain,HTTP/1.0 200 Ok\r\nInner: 1\r\n\r\ninner",
+];
+
+['pid' => $pid, 'uri' => $uri] = http_server($responses, $output);
+
+$nested = false;
+$ctx = stream_context_create([], ['notification' => function ($code) use
(&$nested, $uri) {
+ if ($code === STREAM_NOTIFY_MIME_TYPE_IS && !$nested) {
+ $nested = true;
+ var_dump(file_get_contents($uri));
+ }
+}]);
+
+var_dump(file_get_contents($uri, false, $ctx));
+var_dump(http_get_last_response_headers());
+
+http_server_kill($pid);
+?>
+--EXPECT--
+string(5) "inner"
+string(5) "outer"
+array(3) {
+ [0]=>
+ string(15) "HTTP/1.0 200 Ok"
+ [1]=>
+ string(24) "Content-Type: text/plain"
+ [2]=>
+ string(8) "Outer: 1"
+}
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 0ba9027f2164..e209951cc442 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 shell_exec("echo $code | $php -a"), "\n";
+ echo shell_exec("echo $code | $php $args -a"), "\n";
}
echo "\nDone\n";
diff --git a/sapi/cli/tests/023.phpt b/sapi/cli/tests/023.phpt
index ae8ac5e8da3b..4dbe436a8a80 100644
--- a/sapi/cli/tests/023.phpt
+++ b/sapi/cli/tests/023.phpt
@@ -8,18 +8,19 @@ 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");
$cwd = getcwd();
$ini_file = __DIR__ . "/023.ini";
$ini_file_escaped = escapeshellarg($ini_file);
file_put_contents($ini_file, <<<INI
; no sections should match as cli doesn't support any
-memory_limit = 40M
+max_input_vars = 4
[PATH={$cwd}]
-memory_limit = 50M
+max_input_vars = 5
[PATH=/does/not/exist]
-memory_limit = 60M
+max_input_vars = 6
[HOST=some_fake_host]
-memory_limit = 70M
+max_input_vars = 7
INI
);
$desc = array(
@@ -28,7 +29,7 @@ $desc = array(
2 => array("pipe", "w"),
);
$pipes = array();
-$proc = proc_open("$php -c $ini_file_escaped -r 'echo
ini_get(\"memory_limit\");'", $desc, $pipes);
+$proc = proc_open("$php $args -c $ini_file_escaped -r 'echo
ini_get(\"max_input_vars\");'", $desc, $pipes);
if (!$proc) {
exit(1);
}
@@ -43,5 +44,5 @@ proc_close($proc);
unlink(__DIR__ . "/023.ini");
?>
--EXPECT--
-string(3) "40M"
+string(1) "4"
string(0) ""
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();