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: Use of undefined constant FOO - assumed 'FOO' (this will throw an Error in a future version of PHP) in php shell code on line %d
44php > echo <<<FOO
45<<< > FOOL
46<<< > FOO
47php > ,1;
48FOOL1
49php > echo <<<FOO
50<<< > FOO4
51<<< > FOO
52php > ,2;
53FOO42
54php >
55