MagicStringResolver : undefined property namespacedName
eric-therond opened this issue · 1 comments
eric-therond commented
Hello
when I try to analyze this kind of code :
<?php
$var = new class {
};
the property name of PhpParser\Node\Stmt\Class_ is null
and so I have an error when MagicStringResolver visitor is executed :
PHP Notice: Undefined property: PhpParser\Node\Stmt\Class_::$namespacedName in /home/eric/dev//ircmaxell/php-cfg/lib/PHPCfg/AstVisitor/MagicStringResolver.php on line 26
PHP Fatal error: Uncaught Error: Call to a member function toString() on null in /home/eric/dev/ircmaxell/php-cfg/lib/PHPCfg/AstVisitor/MagicStringResolver.php:26
Stack trace:
#0 /home/eric/dev/nikic/php-parser/lib/PhpParser/NodeTraverser.php(115): PHPCfg\AstVisitor\MagicStringResolver->enterNode(Object(PhpParser\Node\Stmt\Class_))
#1 /home/eric/dev/nikic/php-parser/lib/PhpParser/NodeTraverser.php(134): PhpParser\NodeTraverser->traverseNode(Object(PhpParser\Node\Expr\New_))
#2 /home/eric/dev/nikic/php-parser/lib/PhpParser/NodeTraverser.php(134): PhpParser\NodeTraverser->traverseNode(Object(PhpParser\Node\Expr\Assign))
#3 /home/eric/dev/nikic/php-parser/lib/PhpParser/NodeTraverser.php(200): PhpParser\NodeTraverser->traverseNode(Object(PhpParser\Node\Stmt\Expression)) in /home/eric/dev/ircmaxell/php-cfg/lib/PHPCfg/AstVisitor/MagicStringResolver.php on line 26
I have commited a possible fix in my fork : eric-therond@81f94d5
I can submit a pull request (but it will merge my previous changes related to this pull request #52)
Eric
eric-therond commented
any news for this bug ?