1--TEST--
2Bug #77812 (Interactive mode does not support PHP 7.3-style heredoc)
3--EXTENSIONS--
4readline
5--SKIPIF--
6<?php
7if (READLINE_LIB !== "readline") die('skip readline only');
8if (!function_exists('proc_open')) die('skip proc_open() not available');
9?>
10--FILE--
11<?php
12$php = getenv('TEST_PHP_EXECUTABLE');
13$ini = getenv('TEST_PHP_EXTRA_ARGS');
14$descriptorspec = [['pipe', 'r'], STDOUT, STDERR];
15$proc = proc_open("$php $ini -a", $descriptorspec, $pipes);
16fwrite($pipes[0], "echo <<<FOO\n    bar\n    FOO;\n");
17fwrite($pipes[0], "print(<<<FOO\nxx\nFOO);\n");
18fwrite($pipes[0], "echo <<<FOO\n    xxx\n    FOO;\nFOO\n;\n");
19fwrite($pipes[0], "echo <<<FOO\nFOOL\nFOO\n,1;\n");
20fwrite($pipes[0], "echo <<<FOO\nFOO4\nFOO\n,2;\n");
21fclose($pipes[0]);
22proc_close($proc);
23?>
24--EXPECTF--
25Interactive shell
26
27php > echo <<<FOO
28<<< >     bar
29<<< >     FOO;
30bar
31php > print(<<<FOO
32<<< > xx
33<<< > FOO);
34xx
35php > echo <<<FOO
36<<< >     xxx
37<<< >     FOO;
38xxx
39php > FOO
40php > ;
41
42Warning: Uncaught Error: Undefined constant "FOO" in php shell code:1
43Stack trace:
44#0 {main}
45  thrown in php shell code on line 1
46php > echo <<<FOO
47<<< > FOOL
48<<< > FOO
49php > ,1;
50FOOL1
51php > echo <<<FOO
52<<< > FOO4
53<<< > FOO
54php > ,2;
55FOO42
56php >
57