1--TEST--
2Bug #77812 (Interactive mode does not support PHP 7.3-style heredoc)
3--SKIPIF--
4<?php
5if (!extension_loaded('readline')) die('skip readline extension not available');
6if (READLINE_LIB !== "readline") die('skip readline only');
7if (!function_exists('proc_open')) die('skip proc_open() not available');
8?>
9--FILE--
10<?php
11$php = getenv('TEST_PHP_EXECUTABLE');
12$ini = getenv('TEST_PHP_EXTRA_ARGS');
13$descriptorspec = [['pipe', 'r'], STDOUT, STDERR];
14$proc = proc_open("$php $ini -a", $descriptorspec, $pipes);
15var_dump($proc);
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--
25resource(%d) of type (process)
26Interactive shell
27
28php > echo <<<FOO
29<<< >     bar
30<<< >     FOO;
31bar
32php > print(<<<FOO
33<<< > xx
34<<< > FOO);
35xx
36php > echo <<<FOO
37<<< >     xxx
38<<< >     FOO;
39xxx
40php > FOO
41php > ;
42
43Warning: Uncaught Error: Undefined constant "FOO" in php shell code:1
44Stack trace:
45#0 {main}
46  thrown in php shell code on line 1
47php > echo <<<FOO
48<<< > FOOL
49<<< > FOO
50php > ,1;
51FOOL1
52php > echo <<<FOO
53<<< > FOO4
54<<< > FOO
55php > ,2;
56FOO42
57php >
58