Merge branch 'PHP-7.3' into PHP-7.4

This commit is contained in:
Nikita Popov 2019-10-04 22:46:53 +02:00
commit b078ae6c01
2 changed files with 20 additions and 1 deletions

View file

@ -1603,13 +1603,17 @@ ZEND_API void zend_activate_auto_globals(void) /* {{{ */
int ZEND_FASTCALL zendlex(zend_parser_stack_elem *elem) /* {{{ */
{
zval zv;
int ret;
if (CG(increment_lineno)) {
CG(zend_lineno)++;
CG(increment_lineno) = 0;
}
return lex_scan(&zv, elem);
ret = lex_scan(&zv, elem);
ZEND_ASSERT(!EG(exception) || ret == T_ERROR);
return ret;
}
/* }}} */

View file

@ -2405,6 +2405,9 @@ skip_escape_conversion:
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);
if (PARSER_MODE()) {
RETURN_TOKEN(T_ERROR);
}
}
YYCURSOR = saved_cursor;
@ -2421,6 +2424,7 @@ skip_escape_conversion:
zend_lex_state current_state;
int heredoc_nesting_level = 1;
int first_token = 0;
int error = 0;
zend_save_lexical_state(&current_state);
@ -2468,6 +2472,7 @@ skip_escape_conversion:
|| first_token == T_CURLY_OPEN
) && SCNG(heredoc_indentation)) {
zend_throw_exception_ex(zend_ce_parse_error, 0, "Invalid body indentation level (expecting an indentation level of at least %d)", SCNG(heredoc_indentation));
error = 1;
}
heredoc_label->indentation = SCNG(heredoc_indentation);
@ -2476,6 +2481,10 @@ skip_escape_conversion:
zend_restore_lexical_state(&current_state);
SCNG(heredoc_scan_ahead) = 0;
CG(increment_lineno) = 0;
if (PARSER_MODE() && error) {
RETURN_TOKEN(T_ERROR);
}
}
RETURN_TOKEN(T_START_HEREDOC);
@ -2665,6 +2674,9 @@ double_quotes_scan_done:
if (spacing == (HEREDOC_USING_SPACES | HEREDOC_USING_TABS)) {
zend_throw_exception(zend_ce_parse_error, "Invalid indentation - tabs and spaces cannot be mixed", 0);
if (PARSER_MODE()) {
RETURN_TOKEN(T_ERROR);
}
}
/* newline before label will be subtracted from returned text, but
@ -2786,6 +2798,9 @@ heredoc_scan_done:
if (spacing == (HEREDOC_USING_SPACES | HEREDOC_USING_TABS)) {
zend_throw_exception(zend_ce_parse_error, "Invalid indentation - tabs and spaces cannot be mixed", 0);
if (PARSER_MODE()) {
RETURN_TOKEN(T_ERROR);
}
}
/* newline before label will be subtracted from returned text, but