diff options
| author | Christoph M. Becker <cmbecker69@gmx.de> | 2019-08-21 22:51:51 +0200 |
|---|---|---|
| committer | Christoph M. Becker <cmbecker69@gmx.de> | 2019-08-21 22:51:51 +0200 |
| commit | 310708845ff02b9e252b7a02616290384dd846ba (patch) | |
| tree | 4f599a2dab707e3653e5e01f12ee1b7dfdbeffa4 /Zend/zend_language_scanner.l | |
| parent | 08aafbe93e3ded391446fd84bb5f4a4573ce5f54 (diff) | |
| download | php-git-310708845ff02b9e252b7a02616290384dd846ba.tar.gz | |
Fix #78441: Parse error due to heredoc identifier followed by digit
Since digits are allowed for identifiers, we have to cater to them as
well.
Diffstat (limited to 'Zend/zend_language_scanner.l')
| -rw-r--r-- | Zend/zend_language_scanner.l | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l index af4425ed42..69c392a9bc 100644 --- a/Zend/zend_language_scanner.l +++ b/Zend/zend_language_scanner.l @@ -115,6 +115,7 @@ do { \ #define GET_DOUBLE_QUOTES_SCANNED_LENGTH() SCNG(scanned_string_len) #define IS_LABEL_START(c) (((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && (c) <= 'Z') || (c) == '_' || (c) >= 0x80) +#define IS_LABEL_SUCCESSOR(c) (((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && (c) <= 'Z') || ((c) >= '0' && (c) <= '9') || (c) == '_' || (c) >= 0x80) #define ZEND_IS_OCT(c) ((c)>='0' && (c)<='7') #define ZEND_IS_HEX(c) (((c)>='0' && (c)<='9') || ((c)>='a' && (c)<='f') || ((c)>='A' && (c)<='F')) @@ -2319,7 +2320,7 @@ skip_escape_conversion: /* Check for ending label on the next line */ if (heredoc_label->length < YYLIMIT - YYCURSOR && !memcmp(YYCURSOR, s, heredoc_label->length)) { - if (!IS_LABEL_START(YYCURSOR[heredoc_label->length])) { + if (!IS_LABEL_SUCCESSOR(YYCURSOR[heredoc_label->length])) { if (spacing == (HEREDOC_USING_SPACES | HEREDOC_USING_TABS)) { zend_throw_exception(zend_ce_parse_error, "Invalid indentation - tabs and spaces cannot be mixed", 0); } @@ -2576,7 +2577,7 @@ double_quotes_scan_done: /* Check for ending label on the next line */ if (IS_LABEL_START(*YYCURSOR) && heredoc_label->length < YYLIMIT - YYCURSOR && !memcmp(YYCURSOR, heredoc_label->label, heredoc_label->length)) { - if (IS_LABEL_START(YYCURSOR[heredoc_label->length])) { + if (IS_LABEL_SUCCESSOR(YYCURSOR[heredoc_label->length])) { continue; } @@ -2697,7 +2698,7 @@ heredoc_scan_done: /* Check for ending label on the next line */ if (IS_LABEL_START(*YYCURSOR) && heredoc_label->length < YYLIMIT - YYCURSOR && !memcmp(YYCURSOR, heredoc_label->label, heredoc_label->length)) { - if (IS_LABEL_START(YYCURSOR[heredoc_label->length])) { + if (IS_LABEL_SUCCESSOR(YYCURSOR[heredoc_label->length])) { continue; } |
