Skip to content

"Attempt to assign property 'parent' of non-object" on malformed code #305

Closed

Description

@nikic

Feeding the input <?\&static\ into the parser results in:

Error: Attempt to assign property 'parent' of non-object in /home/nikic/tolerant-php-parser/src/Parser.php:2026
Stack trace:
#0 /home/nikic/tolerant-php-parser/src/Parser.php(1877): Microsoft\PhpParser\Parser->makeBinaryExpression(Object(Microsoft\PhpParser\Node\QualifiedName), Object(Microsoft\PhpParser\Token), NULL, NULL, Object(Microsoft\PhpParser\Node\Statement\ExpressionStatement))
#1 /home/nikic/tolerant-php-parser/src/Parser.php(1648): Microsoft\PhpParser\Parser->parseBinaryExpressionOrHigher(0, Object(Microsoft\PhpParser\Node\Statement\ExpressionStatement))
#2 /home/nikic/tolerant-php-parser/src/Parser.php(581): Microsoft\PhpParser\Parser->parseExpression(Object(Microsoft\PhpParser\Node\Statement\ExpressionStatement), true)
#3 /home/nikic/tolerant-php-parser/src/Parser.php(199): Microsoft\PhpParser\Parser->Microsoft\PhpParser\{closure}(Object(Microsoft\PhpParser\Node\SourceFileNode))
#4 /home/nikic/tolerant-php-parser/src/Parser.php(165): Microsoft\PhpParser\Parser->parseList(Object(Microsoft\PhpParser\Node\SourceFileNode), 0)
#5 /home/nikic/PHP-Fuzzer/example/target_tolerant_php_parser.php(15): Microsoft\PhpParser\Parser->parseSourceFile('<?\\&static\\\n')

Ran into this while testing a fuzzer.

Activity

  1. added a commit that references this issue on Feb 6, 2020
    46204f1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions