Skip to content

Commit 91f129e

Browse files
committed
Add simple cli test for PATH/HOST ini sections
1 parent ee0e696 commit 91f129e

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

sapi/cli/tests/023.phpt

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
--TEST--
2+
HOST/PATH ini sections test for cli
3+
--SKIPIF--
4+
<?php
5+
if (!getenv("TEST_PHP_EXECUTABLE")) die("skip TEST_PHP_EXECUTABLE not set");
6+
if (substr(PHP_OS, 0, 3) == "WIN") die("skip non windows test");
7+
?>
8+
--FILE--
9+
<?php
10+
$php = getenv("TEST_PHP_EXECUTABLE");
11+
$cwd = getcwd();
12+
$ini_file = __DIR__ . "/023.ini";
13+
file_put_contents($ini_file, <<<INI
14+
; no sections should match as cli doesn't support any
15+
memory_limit = 40M
16+
[PATH={$cwd}]
17+
memory_limit = 50M
18+
[PATH=/does/not/exist]
19+
memory_limit = 60M
20+
[HOST=some_fake_host]
21+
memory_limit = 70M
22+
INI
23+
);
24+
$desc = array(
25+
0 => array("pipe", "r"),
26+
1 => array("pipe", "w"),
27+
2 => array("pipe", "w"),
28+
);
29+
$pipes = array();
30+
$proc = proc_open("$php -c $ini_file -r 'echo ini_get(\"memory_limit\");'", $desc, $pipes);
31+
if (!$proc) {
32+
exit(1);
33+
}
34+
var_dump(stream_get_contents($pipes[1]));
35+
var_dump(stream_get_contents($pipes[2]));
36+
37+
proc_terminate($proc);
38+
proc_close($proc);
39+
?>
40+
--CLEAN--
41+
<?php
42+
unlink(__DIR__ . "/023.ini");
43+
?>
44+
--EXPECTF--
45+
string(3) "40M"
46+
string(0) ""

0 commit comments

Comments
 (0)