xref: /PHP-7.3/sapi/cli/tests/bug74600.phpt (revision ded3d984)
1--TEST--
2Bug #74600 (crash (SIGSEGV) in _zend_hash_add_or_update_i)
3--SKIPIF--
4<?php
5if (!getenv("TEST_PHP_EXECUTABLE")) die("skip TEST_PHP_EXECUTABLE not set");
6if (substr(PHP_OS, 0, 3) == "WIN") die("skip non windows test");
7?>
8--FILE--
9<?php
10$php = getenv("TEST_PHP_EXECUTABLE");
11$ini_file = __DIR__ . "/bug74600.ini";
12file_put_contents($ini_file, <<<INI
13[PHP]\n;\rs=\000\000=\n;\r[PATH\000]\000\376 =\n
14INI
15);
16$desc = array(
17	0 => array("pipe", "r"),
18	1 => array("pipe", "w"),
19	2 => array("pipe", "w"),
20);
21$pipes = array();
22$proc = proc_open("$php -c $ini_file -r 'echo \"okey\";'", $desc, $pipes);
23if (!$proc) {
24	exit(1);
25}
26var_dump(stream_get_contents($pipes[1]));
27var_dump(stream_get_contents($pipes[2]));
28
29proc_terminate($proc);
30proc_close($proc);
31?>
32--CLEAN--
33<?php
34unlink(__DIR__ . "/bug74600.ini");
35?>
36--EXPECT--
37string(4) "okey"
38string(0) ""
39