xref: /PHP-5.6/sapi/cli/tests/bug64529.phpt (revision 108bf849)
1--TEST--
2Bug #64529 (Ran out of opcode space)
3--SKIPIF--
4<?php
5if (substr(PHP_OS, 0, 3) == "WIN") {
6	die("skip non windows test");
7}
8exec('which expect', $output, $ret);
9if ($ret) {
10	die("skip no expect installed");
11}
12?>
13--FILE--
14<?php
15$expect_executable = trim(`which expect`);
16$php_executable = getenv('TEST_PHP_EXECUTABLE');
17$script = __DIR__ . "/expect.sh";
18
19if (extension_loaded("readline")) {
20	$expect_script = <<<SCRIPT
21
22set php_executable [lindex \$argv 0]
23
24spawn \$php_executable -n -d cli.prompt="" -a
25
26expect "php >"
27
28send "echo 'hello world';\n"
29send "\04"
30
31expect eof
32
33exit
34
35SCRIPT;
36
37} else {
38	$expect_script = <<<SCRIPT
39
40set php_executable [lindex \$argv 0]
41
42spawn \$php_executable -n -d cli.prompt="" -a
43
44expect "Interactive mode enabled"
45
46send "<?php echo 'hello world';\n"
47send "\04"
48
49expect eof
50
51exit
52
53SCRIPT;
54}
55
56file_put_contents($script, $expect_script);
57
58system($expect_executable . " " . $script . " " . $php_executable);
59
60@unlink($script);
61?>
62--EXPECTF--
63spawn %sphp -n -d cli.prompt="" -a
64Interactive %s
65
66%Secho 'hello world';
67%Shello world
68