Skip to content

Commit fc8cfb1

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

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
--TEST--
2+
No warnings should be thrown during heredoc scan-ahead
3+
--FILE--
4+
<?php
5+
6+
<<<TEST
7+
\400
8+
${"\400"}
9+
TEST;
10+
11+
?>
12+
--EXPECTF--
13+
Warning: Octal escape sequence overflow \400 is greater than \377 in %s on line %d
14+
15+
Warning: Octal escape sequence overflow \400 is greater than \377 in %s on line %d
16+
17+
Warning: Undefined variable $ in %s on line %d

Zend/zend_language_scanner.l

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,8 +1113,7 @@ static zend_result zend_scan_escape_string(zval *zendlval, char *str, int len, c
11131113
octal_buf[2] = *(++s);
11141114
}
11151115
}
1116-
if (octal_buf[2] &&
1117-
(octal_buf[0] > '3')) {
1116+
if (octal_buf[2] && (octal_buf[0] > '3') && !SCNG(heredoc_scan_ahead)) {
11181117
/* 3 octit values must not overflow 0xFF (\377) */
11191118
zend_error(E_COMPILE_WARNING, "Octal escape sequence overflow \\%s is greater than \\377", octal_buf);
11201119
}

0 commit comments

Comments
 (0)