[php-src] Issue #14961: Comments between object operator and semi-reserved name result in parse error
| From: | bwoebi | Date: | Mon, 15 Jul 2024 15:59:38 +0000 |
| Subject: | [php-src] Issue #14961: Comments between object operator and semi-reserved name result in parse error | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-247296@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/14961
Author: bwoebi
### Description
The following code:
```php
<?php
class A {
public $class = A::class;
}
var_dump((new A)-> /* a meaningful comment */ class);
```
Resulted in this output:
```
Parse error: syntax error, unexpected token "class", expecting identifier or variable or
"{" or "$" in /in/8t7hs on line 7
```
But I expected this output instead:
```
string(1) "A"
```
Looks like we're popping out of ST_LOOKING_FOR_PROPERTY when encountering a comment, leaving us
in a bad state.
### PHP Version
master (all versions of PHP 8)
### Operating System
_No response_