Unknown Node Encountered : Stmt_GroupUse
eric-therond opened this issue · 5 comments
Hello
when analyzing
use foo\math\{ Math, const PI, function sin, function cos, function cosh };
I have this error :
PHP Fatal error: Uncaught RuntimeException: Unknown Node Encountered : Stmt_GroupUse in /home/eric/ircmaxell/php-cfg/lib/PHPCfg/Parser.php:170
Stack trace:
#0 /home/eric/ircmaxell/php-cfg/lib/PHPCfg/Parser.php(106): PHPCfg\Parser->parseNode(Object(PhpParser\Node\Stmt\GroupUse))
#1 /home/eric/ircmaxell/php-cfg/lib/PHPCfg/Parser.php(127): PHPCfg\Parser->parseNodes(Array, Object(PHPCfg\Block))
#2 /home/eric/ircmaxell/php-cfg/lib/PHPCfg/Parser.php(91): PHPCfg\Parser->parseFunc(Object(PHPCfg\Func), Array, Array)
#3 /home/eric/ircmaxell/php-cfg/lib/PHPCfg/Parser.php(76): PHPCfg\Parser->parseAst(Array, './tests/negativ...')
#4 /home/eric/tests/testphpcfg.php(10): PHPCfg\Parser->parse('<?php\n\nuse foo\...', './tests/negativ...')
#5 {main}
thrown in /home/eric/ircmaxell/php-cfg/lib/PHPCfg/Parser.php on line 170
I have proposed a fix here
Same here using prog pilot
See designsecurity/progpilot#20 (comment) for details
All you need to do is add a blank function inside the Parser class:
protected function parseStmt_GroupUse(Stmt\GroupUse $node)
{
// ignore use statements, since names are already resolved
}
If that works, would you be willing to send a PR?
Will try the next days
Just following up, were you able to test?