bug77812-libedit.phpt 1000 B

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