xref: /php-src/sapi/cli/tests/bug74600.phpt (revision dcc3255b)
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_ESCAPED");
11$ini_file = __DIR__ . "/bug74600.ini";
12$ini_file_escaped = escapeshellarg($ini_file);
13file_put_contents($ini_file, <<<INI
14[PHP]\n;\rs=\000\000=\n;\r[PATH\000]\000\376 =\n
15INI
16);
17$desc = array(
18    0 => array("pipe", "r"),
19    1 => array("pipe", "w"),
20    2 => array("pipe", "w"),
21);
22$pipes = array();
23$proc = proc_open("$php -c $ini_file_escaped -r 'echo \"okey\";'", $desc, $pipes);
24if (!$proc) {
25    exit(1);
26}
27var_dump(stream_get_contents($pipes[1]));
28var_dump(stream_get_contents($pipes[2]));
29
30proc_terminate($proc);
31proc_close($proc);
32?>
33--CLEAN--
34<?php
35unlink(__DIR__ . "/bug74600.ini");
36?>
37--EXPECT--
38string(4) "okey"
39string(0) ""
40