Skip to content

PHP-Parser broken on PHP 8.0.0-dev #684

@ondrejmirtes

Description

@ondrejmirtes

Hi, I prepared a minimal reproducing repo:

https://github.com/ondrejmirtes/php-8-parser-repro

The script to show the error is to run:

                composer install
                php --version
                vendor/bin/php-parse ConstantStringType.php

The current output (can be seen in GitHub Actions https://github.com/ondrejmirtes/php-8-parser-repro/runs/873878820?check_suite_focus=true) is:

PHP 8.0.0-dev (cli) (built: Jul 15 2020 00:48:57) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.0-dev, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.0-dev, Copyright (c), by Zend Technologies
====> File ConstantStringType.php:
PHP Notice:  Undefined array key 338 in /home/runner/work/php-8-parser-repro/php-8-parser-repro/vendor/nikic/php-parser/lib/PhpParser/Lexer.php on line 284
PHP Fatal error:  Uncaught TypeError: PhpParser\Lexer::getNextToken(): Return value must be of type int, null returned in /home/runner/work/php-8-parser-repro/php-8-parser-repro/vendor/nikic/php-parser/lib/PhpParser/Lexer.php:324
Stack trace:
#0 /home/runner/work/php-8-parser-repro/php-8-parser-repro/vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php(208): PhpParser\Lexer->getNextToken()
#1 /home/runner/work/php-8-parser-repro/php-8-parser-repro/vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php(158): PhpParser\ParserAbstract->doParse()
#2 /home/runner/work/php-8-parser-repro/php-8-parser-repro/vendor/nikic/php-parser/lib/PhpParser/Parser/Multiple.php(51): PhpParser\ParserAbstract->parse()
#3 /home/runner/work/php-8-parser-repro/php-8-parser-repro/vendor/nikic/php-parser/lib/PhpParser/Parser/Multiple.php(32): PhpParser\Parser\Multiple->tryParse()
#4 /home/runner/work/php-8-parser-repro/php-8-parser-repro/vendor/nikic/php-parser/bin/php-parse(71): PhpParser\Parser\Multiple->parse()
#5 {main}
  thrown in /home/runner/work/php-8-parser-repro/php-8-parser-repro/vendor/nikic/php-parser/lib/PhpParser/Lexer.php on line 324

Of course I'm not sure what exactly in ConstantStringType is causing this, and whether it's a bug of PHP 8, or the PHP-Parser.

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions