xref: /PHP-8.2/sapi/cli/tests/gh14189.phpt (revision 217b753a)
1--TEST--
2GH-14189 (PHP Interactive shell input state incorrectly handles quoted heredoc literals.)
3--EXTENSIONS--
4readline
5--SKIPIF--
6<?php
7include "skipif.inc";
8if (readline_info('done') === NULL) {
9    die ("skip need readline support");
10}
11?>
12--FILE--
13<?php
14$php = getenv('TEST_PHP_EXECUTABLE');
15
16// disallow console escape sequences that may break the output
17putenv('TERM=VT100');
18
19$code = <<<EOT
20\$test = <<<"EOF"
21foo
22bar
23baz
24EOF;
25echo \$test;
26exit
27EOT;
28
29$code = escapeshellarg($code);
30echo `echo $code | "$php" -a`, "\n";
31?>
32--EXPECT--
33Interactive shell
34
35php > $test = <<<"EOF"
36<<< > foo
37<<< > bar
38<<< > baz
39<<< > EOF;
40php > echo $test;
41foo
42bar
43baz
44php > exit
45