Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The ast parser >=8.1 cannot correctly handle T_REFERENCE_FOLLOWED_BY_VAR_OR_VARARG #275

Closed
nabice opened this issue May 21, 2024 · 1 comment
Assignees
Labels

Comments

@nabice
Copy link

nabice commented May 21, 2024

Sample Code:

<?php
$a & $b;

return an ASTError Node.

@nabice nabice added the bug label May 21, 2024
@nabice
Copy link
Author

nabice commented May 22, 2024

My test code:

import org.eclipse.php.core.PHPVersion;
import org.eclipse.php.core.ast.nodes.*;

public class Test {
    public static void main(String[] args) {
        String str = "<?php\n $a & $b;?> ";
        try{
            ASTParser parser = ASTParser.newParser(PHPVersion.PHP8_3, false, false);
            parser.setSource(str.toCharArray());
            AST ast = parser.createAST(null).getAST();
            System.out.println(ast);
        } catch (Throwable e) {
        }
    }
}

Output: Syntax error at character 10 of input

PHP8_0 is OK.

@zulus zulus self-assigned this May 24, 2024
@zulus zulus closed this as completed in cdabb00 May 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants