Merge branch 'PHP-7.4'

* PHP-7.4:
  Avoid duplicate octal warning during heredoc scan ahead
This commit is contained in:
Nikita Popov 2020-09-04 11:00:09 +02:00
commit fc8cfb1b1a
2 changed files with 18 additions and 2 deletions

View file

@ -0,0 +1,17 @@
--TEST--
No warnings should be thrown during heredoc scan-ahead
--FILE--
<?php
<<<TEST
\400
${"\400"}
TEST;
?>
--EXPECTF--
Warning: Octal escape sequence overflow \400 is greater than \377 in %s on line %d
Warning: Octal escape sequence overflow \400 is greater than \377 in %s on line %d
Warning: Undefined variable $ in %s on line %d

View file

@ -1113,8 +1113,7 @@ static zend_result zend_scan_escape_string(zval *zendlval, char *str, int len, c
octal_buf[2] = *(++s);
}
}
if (octal_buf[2] &&
(octal_buf[0] > '3')) {
if (octal_buf[2] && (octal_buf[0] > '3') && !SCNG(heredoc_scan_ahead)) {
/* 3 octit values must not overflow 0xFF (\377) */
zend_error(E_COMPILE_WARNING, "Octal escape sequence overflow \\%s is greater than \\377", octal_buf);
}