Patch fix-77812 for Readline related Bug #77812
Patch version 2019-08-17 15:54 UTC
Return to Bug #77812 |
Download this patch
Patch Revisions:
Developer: cmb@php.net
ext/readline/readline_cli.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/ext/readline/readline_cli.c b/ext/readline/readline_cli.c
index 69ebe117cb..c7e9c02b51 100644
--- a/ext/readline/readline_cli.c
+++ b/ext/readline/readline_cli.c
@@ -349,9 +349,14 @@ static int cli_is_valid_code(char *code, size_t len, zend_string **prompt) /* {{
case heredoc:
if (code[i - (heredoc_len + 1)] == '\n' && !strncmp(code + i - heredoc_len, heredoc_tag, heredoc_len) && code[i] == '\n') {
code_type = body;
- } else if (code[i - (heredoc_len + 2)] == '\n' && !strncmp(code + i - heredoc_len - 1, heredoc_tag, heredoc_len) && code[i-1] == ';' && code[i] == '\n') {
+ } else if (!strncmp(code + i - heredoc_len + 1, heredoc_tag, heredoc_len)) {
+ char c = code[i + 1];
+ char *p = code + i - heredoc_len;
+
+ if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || c == '_') break;
+ while (*p == ' ' && *p != '\n') p--;
+ if (*p != '\n') break;
code_type = body;
- valid_end = 1;
}
break;
case outside:
|