Skip to content

Commit e0a14bc

Browse files
committed
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: Avoid duplicate octal warning during heredoc scan ahead
2 parents 2dabc4c + e8d36ce commit e0a14bc

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Zend/tests/warning_during_heredoc_scan_ahead.phpt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ No warnings should be thrown during heredoc scan-ahead
66
<<<TEST
77
${x}
88
\400
9+
${"\400"}
910
${/*}
1011
TEST;
1112

@@ -15,6 +16,8 @@ Warning: Unexpected character in input: '' (ASCII=1) state=0 in %s on line %d
1516

1617
Warning: Octal escape sequence overflow \400 is greater than \377 in %s on line %d
1718

19+
Warning: Octal escape sequence overflow \400 is greater than \377 in %s on line %d
20+
1821
Warning: Unterminated comment starting line %d in %s on line %d
1922

2023
Parse error: syntax error, unexpected end of file in %s on line %d

Zend/zend_language_scanner.l

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,8 +1072,7 @@ static int zend_scan_escape_string(zval *zendlval, char *str, int len, char quot
10721072
octal_buf[2] = *(++s);
10731073
}
10741074
}
1075-
if (octal_buf[2] &&
1076-
(octal_buf[0] > '3')) {
1075+
if (octal_buf[2] && (octal_buf[0] > '3') && !SCNG(heredoc_scan_ahead)) {
10771076
/* 3 octit values must not overflow 0xFF (\377) */
10781077
zend_error(E_COMPILE_WARNING, "Octal escape sequence overflow \\%s is greater than \\377", octal_buf);
10791078
}

0 commit comments

Comments
 (0)