Skip to content

Commit f88fc9c

Browse files
committed
Merge branch 'PHP-8.3'
* PHP-8.3: Fix GH-14189: PHP Interactive shell input state incorrectly handles quoted heredoc literals.
2 parents d934840 + f365ced commit f88fc9c

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

ext/readline/readline_cli.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ static int cli_is_valid_code(char *code, size_t len, zend_string **prompt) /* {{
343343
case ' ':
344344
case '\t':
345345
case '\'':
346+
case '"':
346347
break;
347348
case '\r':
348349
case '\n':

sapi/cli/tests/gh14189.phpt

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
--TEST--
2+
GH-14189 (PHP Interactive shell input state incorrectly handles quoted heredoc literals.)
3+
--EXTENSIONS--
4+
readline
5+
--SKIPIF--
6+
<?php
7+
include "skipif.inc";
8+
if (readline_info('done') === NULL) {
9+
die ("skip need readline support");
10+
}
11+
?>
12+
--FILE--
13+
<?php
14+
$php = getenv('TEST_PHP_EXECUTABLE');
15+
16+
// disallow console escape sequences that may break the output
17+
putenv('TERM=VT100');
18+
19+
$code = <<<EOT
20+
\$test = <<<"EOF"
21+
foo
22+
bar
23+
baz
24+
EOF;
25+
echo \$test;
26+
exit
27+
EOT;
28+
29+
$code = escapeshellarg($code);
30+
echo `echo $code | "$php" -a`, "\n";
31+
?>
32+
--EXPECT--
33+
Interactive shell
34+
35+
php > $test = <<<"EOF"
36+
<<< > foo
37+
<<< > bar
38+
<<< > baz
39+
<<< > EOF;
40+
php > echo $test;
41+
foo
42+
bar
43+
baz
44+
php > exit

0 commit comments

Comments
 (0)