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 !== "libedit") die('skip libedit 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
28bar
29xx
30xxx
31
32Warning: Uncaught Error: Undefined constant "FOO" in php shell code:1
33Stack trace:
34#0 {main}
35  thrown in php shell code on line 1
36FOOL1
37FOO42
38