Merge branch 'PHP-8.3'

* PHP-8.3:
  Fix GH-14189: PHP Interactive shell input state incorrectly handles quoted heredoc literals.
This commit is contained in:
Niels Dossche 2024-05-10 16:49:05 +02:00
commit f88fc9c6e8
No known key found for this signature in database
GPG Key ID: B8A8AD166DF0E2E5
2 changed files with 45 additions and 0 deletions

View File

@ -343,6 +343,7 @@ static int cli_is_valid_code(char *code, size_t len, zend_string **prompt) /* {{
case ' ':
case '\t':
case '\'':
case '"':
break;
case '\r':
case '\n':

View File

@ -0,0 +1,44 @@
--TEST--
GH-14189 (PHP Interactive shell input state incorrectly handles quoted heredoc literals.)
--EXTENSIONS--
readline
--SKIPIF--
<?php
include "skipif.inc";
if (readline_info('done') === NULL) {
die ("skip need readline support");
}
?>
--FILE--
<?php
$php = getenv('TEST_PHP_EXECUTABLE');
// disallow console escape sequences that may break the output
putenv('TERM=VT100');
$code = <<<EOT
\$test = <<<"EOF"
foo
bar
baz
EOF;
echo \$test;
exit
EOT;
$code = escapeshellarg($code);
echo `echo $code | "$php" -a`, "\n";
?>
--EXPECT--
Interactive shell
php > $test = <<<"EOF"
<<< > foo
<<< > bar
<<< > baz
<<< > EOF;
php > echo $test;
foo
bar
baz
php > exit