summaryrefslogtreecommitdiff
path: root/Zend/zend_globals.h
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-06-05 16:55:20 +0200
committerNikita Popov <nikita.ppv@gmail.com>2020-06-08 12:55:14 +0200
commitb03cafd19c01db57b89727ce77cc89a7d816077c (patch)
treeb8e39eeca2edf8fbb74e4b3fb7e2979470b959c0 /Zend/zend_globals.h
parent08518b18b2095b8c5158e272b4fe6c339f0eb1b7 (diff)
downloadphp-git-b03cafd19c01db57b89727ce77cc89a7d816077c.tar.gz
Fix bug #77966: Cannot alias a method named "namespace"
This is a bit tricky: In this cases we have "namespace as", which means that we will only recognize "namespace" as an identifier when the lookahead token is already at the "as". This means that zend_lex_tstring picks up the wrong identifier. We solve this by actually assigning the identifier as the semantic value on the parser stack -- as in almost all cases we will not actually need the identifier, this is just an (offset, size) reference, not a copy of the string. Additionally, we need to teach the lexer feedback mechanism used by tokenizer TOKEN_PARSE mode to apply feedback to something other than the very last token. To that purpose we pass through the token text and check the tokens in reverse order to find the right one. Closes GH-5668.
Diffstat (limited to 'Zend/zend_globals.h')
-rw-r--r--Zend/zend_globals.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/Zend/zend_globals.h b/Zend/zend_globals.h
index 1d64d001f6..60d32c0335 100644
--- a/Zend/zend_globals.h
+++ b/Zend/zend_globals.h
@@ -311,7 +311,9 @@ struct _zend_php_scanner_globals {
int scanned_string_len;
/* hooks */
- void (*on_event)(zend_php_scanner_event event, int token, int line, void *context);
+ void (*on_event)(
+ zend_php_scanner_event event, int token, int line,
+ const char *text, size_t length, void *context);
void *on_event_context;
};