Commit 72df320
committed
Tokenizer::createTokenMap(): stabilize code for parenthesis owners
_I didn't dare to make this change while JS/CSS were still supported, but this should be a safe change now._
For all PHP parenthesis owners, the open parenthesis MUST be the next non-empty token.
There is only one exception to this rule and that is the `T_FUNCTION` keyword where a `T_STRING` function name and potentially a `&` for return by reference are also allowed between.
If the parenthesis owner is not the next valid token, the token should not be marked as a parenthesis owner, not get the other parenthesis keys.
Now, while for valid code the above should always be true. For invalid code and a few edge cases, such as anonymous classes without parentheses, it is currently possible for the tokenizer to walk too far and identify a completely unrelated arbitrary open parenthesis as the parenthesis belonging to a parenthesis owner.
The change in this commit should prevent that.1 parent f21b187 commit 72df320
1 file changed
+24
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
628 | 628 | | |
629 | 629 | | |
630 | 630 | | |
631 | | - | |
632 | | - | |
| 631 | + | |
633 | 632 | | |
634 | 633 | | |
635 | 634 | | |
636 | 635 | | |
637 | 636 | | |
638 | 637 | | |
639 | 638 | | |
640 | | - | |
641 | | - | |
642 | | - | |
643 | | - | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
644 | 645 | | |
645 | | - | |
646 | | - | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
647 | 662 | | |
648 | 663 | | |
649 | 664 | | |
650 | 665 | | |
651 | | - | |
652 | | - | |
653 | | - | |
654 | | - | |
655 | 666 | | |
656 | | - | |
657 | | - | |
658 | | - | |
659 | | - | |
| 667 | + | |
660 | 668 | | |
661 | 669 | | |
662 | 670 | | |
| |||
0 commit comments