xref: /PHP-7.0/sapi/cli/tests/bug64529.phpt (revision 163d26d5)
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}
8if (!extension_loaded("readline") || !readline_info("done")) {
9	die("skip readline support required");
10}
11exec('which expect', $output, $ret);
12if ($ret) {
13	die("skip no expect installed");
14}
15?>
16--FILE--
17<?php
18$expect_executable = trim(`which expect`);
19$php_executable = getenv('TEST_PHP_EXECUTABLE');
20$script = __DIR__ . "/expect.sh";
21
22if (extension_loaded("readline")) {
23	$expect_script = <<<SCRIPT
24
25set php_executable [lindex \$argv 0]
26
27spawn \$php_executable -n -d cli.prompt="" -a
28
29expect "php >"
30
31send "echo 'hello world';\n"
32send "\04"
33
34expect eof
35
36exit
37
38SCRIPT;
39
40} else {
41	$expect_script = <<<SCRIPT
42
43set php_executable [lindex \$argv 0]
44
45spawn \$php_executable -n -d cli.prompt="" -a
46
47expect "Interactive mode enabled"
48
49send "<?php echo 'hello world';\n"
50send "\04"
51
52expect eof
53
54exit
55
56SCRIPT;
57}
58
59file_put_contents($script, $expect_script);
60
61system($expect_executable . " " . $script . " " . $php_executable);
62
63@unlink($script);
64?>
65--EXPECTF--
66spawn %sphp -n -d cli.prompt="" -a
67Interactive %s
68
69%Secho 'hello world';
70%Shello world
71