[php-src] PR #23618: Fix GH-23552: keyword class constant name not retagged to T_STRING
| From: | iliaal | Date: | Tue, 08 Sep 2026 17:18:51 +0000 |
| Subject: | [php-src] PR #23618: Fix GH-23552: keyword class constant name not retagged to T_STRING | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-38389@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/23618
Author: iliaal
class F { const NEW = Bar::NEW; } reported T_NEW for the declared name
under token_get_all($code, TOKEN_PARSE). The tokenizer resolved a parser feedback by
searching the collected token list backwards for a matching token text, and since 8.3 typed class
constants defer reducing the constant name past the initializer scan, so the declaration's
feedback re-found the initializer's token. Matching the ident's source offset instead also
corrects const NEW = NEW Bar();, where the text search retagged the NEW
operator and left the declaration alone.
The offset is accumulated as tokens are emitted rather than derived from
LANG_SCNG(yy_cursor). The unterminated-comment rule returns T_ERROR before
recomputing yyleng, so the cursor overshoots the emitted length there; the test pins
that input.
Fixes #23552