Commit c522554a02d for php
commit c522554a02dbecf23738b82b590bb1dd983591a5
Author: Michael Orlitzky <michael@orlitzky.com>
Date: Mon Jul 10 21:08:48 2023 -0400
sapi/cli/tests/023.phpt: support TEST_PHP_EXTRA_ARGS
This test runs the PHP test executable from the command-line, but was
not passing TEST_PHP_EXTRA_ARGS to it from run-tests.php. This commit
adds the args, but also updates the test case.
This test relies on memory_limit being updated by an INI file
(generated on-the-fly), but by default, run-tests.php overrides PHP's
memory_limit using TEST_PHP_EXTRA_ARGS. So if we pass the extra args
to PHP, then the memory limit will be constant. To work around that,
we switch to using max_input_vars (as opposed to memory_limit) inside
the test.
diff --git a/sapi/cli/tests/023.phpt b/sapi/cli/tests/023.phpt
index ae8ac5e8da3..4dbe436a8a8 100644
--- a/sapi/cli/tests/023.phpt
+++ b/sapi/cli/tests/023.phpt
@@ -8,18 +8,19 @@
--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 @@
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 @@
unlink(__DIR__ . "/023.ini");
?>
--EXPECT--
-string(3) "40M"
+string(1) "4"
string(0) ""