mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: Fix #78441: Parse error due to heredoc identifier followed by digit
This commit is contained in:
commit
1eb75f2937
3 changed files with 31 additions and 3 deletions
3
NEWS
3
NEWS
|
@ -2,6 +2,9 @@ PHP NEWS
|
||||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||
?? ??? ????, PHP 7.4.0RC1
|
?? ??? ????, PHP 7.4.0RC1
|
||||||
|
|
||||||
|
- Core:
|
||||||
|
. Fixed bug #78441 (Parse error due to heredoc identifier followed by digit).
|
||||||
|
(cmb)
|
||||||
|
|
||||||
22 Aug 2019, PHP 7.4.0beta4
|
22 Aug 2019, PHP 7.4.0beta4
|
||||||
|
|
||||||
|
|
24
Zend/tests/grammar/bug78441.phpt
Normal file
24
Zend/tests/grammar/bug78441.phpt
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
--TEST--
|
||||||
|
Bug #78441 (Parse error due to heredoc identifier followed by digit)
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
echo <<<FOO
|
||||||
|
FOO4
|
||||||
|
FOO, PHP_EOL;
|
||||||
|
|
||||||
|
echo <<<FOO
|
||||||
|
bar
|
||||||
|
FOO4
|
||||||
|
FOO, PHP_EOL;
|
||||||
|
|
||||||
|
echo <<<'FOO'
|
||||||
|
bar
|
||||||
|
FOO4
|
||||||
|
FOO, PHP_EOL;
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
FOO4
|
||||||
|
bar
|
||||||
|
FOO4
|
||||||
|
bar
|
||||||
|
FOO4
|
|
@ -113,6 +113,7 @@ do { \
|
||||||
#define GET_DOUBLE_QUOTES_SCANNED_LENGTH() SCNG(scanned_string_len)
|
#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_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_OCT(c) ((c)>='0' && (c)<='7')
|
||||||
#define ZEND_IS_HEX(c) (((c)>='0' && (c)<='9') || ((c)>='a' && (c)<='f') || ((c)>='A' && (c)<='F'))
|
#define ZEND_IS_HEX(c) (((c)>='0' && (c)<='9') || ((c)>='a' && (c)<='f') || ((c)>='A' && (c)<='F'))
|
||||||
|
@ -2419,7 +2420,7 @@ skip_escape_conversion:
|
||||||
|
|
||||||
/* Check for ending label on the next line */
|
/* Check for ending label on the next line */
|
||||||
if (heredoc_label->length < YYLIMIT - YYCURSOR && !memcmp(YYCURSOR, s, heredoc_label->length)) {
|
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)) {
|
if (spacing == (HEREDOC_USING_SPACES | HEREDOC_USING_TABS)) {
|
||||||
zend_throw_exception(zend_ce_parse_error, "Invalid indentation - tabs and spaces cannot be mixed", 0);
|
zend_throw_exception(zend_ce_parse_error, "Invalid indentation - tabs and spaces cannot be mixed", 0);
|
||||||
}
|
}
|
||||||
|
@ -2676,7 +2677,7 @@ double_quotes_scan_done:
|
||||||
|
|
||||||
/* Check for ending label on the next line */
|
/* 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 < 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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2797,7 +2798,7 @@ heredoc_scan_done:
|
||||||
|
|
||||||
/* Check for ending label on the next line */
|
/* 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 < 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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue