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

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

Closed
nikic opened this issue Dec 22, 2019 · 0 comments · Fixed by #311
Closed

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

nikic opened this issue Dec 22, 2019 · 0 comments · Fixed by #311

Comments

@nikic
Copy link
Contributor

nikic commented Dec 22, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant