1--TEST--
2Bug #77812 (Interactive mode does not support PHP 7.3-style heredoc)
3--EXTENSIONS--
4readline
5--SKIPIF--
6<?php
7if (READLINE_LIB !== "libedit") die('skip libedit 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);
16var_dump($proc);
17fwrite($pipes[0], "echo <<<FOO\n    bar\n    FOO;\n");
18fwrite($pipes[0], "print(<<<FOO\nxx\nFOO);\n");
19fwrite($pipes[0], "echo <<<FOO\n    xxx\n    FOO;\nFOO\n;\n");
20fwrite($pipes[0], "echo <<<FOO\nFOOL\nFOO\n,1;\n");
21fwrite($pipes[0], "echo <<<FOO\nFOO4\nFOO\n,2;\n");
22fclose($pipes[0]);
23proc_close($proc);
24?>
25--EXPECTF--
26resource(%d) of type (process)
27Interactive shell
28
29bar
30xx
31xxx
32
33Warning: Uncaught Error: Undefined constant "FOO" in php shell code:1
34Stack trace:
35#0 {main}
36  thrown in php shell code on line 1
37FOOL1
38FOO42
39