Skip to content

Conversation

@jrfnl
Copy link
Contributor

@jrfnl jrfnl commented Nov 23, 2020

As of PHP 8, interpolated text strings can be dereferenced, however, the square brackets are incorrectly tokenized as short array brackets instead of as "normal" square brackets.

Fixed by adding the T_DOUBLE_QUOTED_STRING token to the allowed tokens for leaving the brackets alone in the PHP Tokenizer class.

Includes unit test.

Ref: https://wiki.php.net/rfc/variable_syntax_tweaks#interpolated_and_non-interpolated_strings

…ith interpolated variables

As of PHP 8, interpolated text strings can be dereferenced, however, the square brackets are incorrectly tokenized as _short array_ brackets instead of as "normal" square brackets.

Fixed by adding the `T_DOUBLE_QUOTED_STRING` token to the allowed tokens for leaving the brackets alone in the PHP Tokenizer class.

Includes unit test.

Ref: https://wiki.php.net/rfc/variable_syntax_tweaks#interpolated_and_non-interpolated_strings
@gsherwood
Copy link
Member

Thanks! I wasn't aware of this change.

@jrfnl jrfnl deleted the php-8.0/tokenizer-interpolated-string-dereferencing branch November 23, 2020 22:45
@jrfnl
Copy link
Contributor Author

jrfnl commented Nov 23, 2020

One of those which easily slips through the cracks, only just noticed it the other day myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants