TysonAndre / phan

Phan is a static analyzer for PHP. Phan prefers to avoid false-positives and attempts to prove incorrectness rather than correctness.
Other
0 stars 0 forks source link

Uncaught IssueException when analyzing binary operation with undefined variable #54

Closed TysonAndre closed 6 years ago

TysonAndre commented 7 years ago

Noticed on this fork, not sure if upstream is affected.

Phan\Exception\IssueException in /path/to/phan/src/Phan/AST/ContextNode.php:606
Stack trace:
#0 /path/to/phan/src/Phan/Analysis/ConditionVisitor.php(115): Phan\AST\ContextNode->getVariable()
#1 /path/to/phan/src/Phan/Analysis/ConditionVisitor.php(91): Phan\Analysis\ConditionVisitor->analyzeVarIsIdentical(Object(ast\Node), Object(ast\Node))
#2 /path/to/phan/src/Phan/Analysis/ConditionVisitor.php(78): Phan\Analysis\ConditionVisitor->analyzeIsIdentical(Object(ast\Node), Object(ast\Node))
#3 /path/to/phan/src/Phan/AST/Visitor/KindVisitorImplementation.php(26): Phan\Analysis\ConditionVisitor->visitBinaryOp(Object(ast\Node))
#4 /path/to/phan/src/Phan/Analysis/PreOrderAnalysisVisitor.php(725): Phan\AST\Visitor\KindVisitorImplementation->__invoke(Object(ast\Node))
#5 /path/to/phan/src/Phan/AST/Visitor/KindVisitorImplementation.php(26): Phan\Analysis\PreOrderAnalysisVisitor->visitIfElem(Object(ast\Node))
#6 /path/to/phan/src/Phan/BlockAnalysisVisitor.php(589): Phan\AST\Visitor\KindVisitorImplementation->__invoke(Object(ast\Node))
#7 /path/to/phan/src/Phan/BlockAnalysisVisitor.php(297): Phan\BlockAnalysisVisitor->preOrderAnalyze(Object(Phan\Language\Context), Object(ast\Node))
#8 /path/to/phan/src/Phan/AST/Visitor/Element.php(142): Phan\BlockAnalysisVisitor->visitIfElem(Object(ast\Node))
#9 /path/to/phan/src/Phan/BlockAnalysisVisitor.php(176): Phan\AST\Visitor\Element::acceptNodeAndKindVisitor(Object(ast\Node), Object(Phan\BlockAnalysisVisitor))
#10 /path/to/phan/src/Phan/BlockAnalysisVisitor.php(247): Phan\BlockAnalysisVisitor->analyzeAndGetUpdatedContext(Object(Phan\Language\Context), Object(ast\Node), Object(ast\Node))
#11 /path/to/phan/src/Phan/BlockAnalysisVisitor.php(417): Phan\BlockAnalysisVisitor->visitBranchedContext(Object(ast\Node))
#12 /path/to/phan/src/Phan/AST/Visitor/Element.php(142): Phan\BlockAnalysisVisitor->visitIf(Object(ast\Node))
#13 /path/to/phan/src/Phan/BlockAnalysisVisitor.php(176): Phan\AST\Visitor\Element::acceptNodeAndKindVisitor(Object(ast\Node), Object(Phan\BlockAnalysisVisitor))
#14 /path/to/phan/src/Phan/BlockAnalysisVisitor.php(122): Phan\BlockAnalysisVisitor->analyzeAndGetUpdatedContext(Object(Phan\Language\Context), Object(ast\Node), Object(ast\Node))
#15 /path/to/phan/src/Phan/AST/Visitor/KindVisitorImplementation.php(315): Phan\BlockAnalysisVisitor->visit(Object(ast\Node))
#16 /path/to/phan/src/Phan/AST/Visitor/Element.php(142): Phan\AST\Visitor\KindVisitorImplementation->visitStmtList(Object(ast\Node))
#17 /path/to/phan/src/Phan/BlockAnalysisVisitor.php(176): Phan\AST\Visitor\Element::acceptNodeAndKindVisitor(Object(ast\Node), Object(Phan\BlockAnalysisVisitor))
#18 /path/to/phan/src/Phan/BlockAnalysisVisitor.php(315): Phan\BlockAnalysisVisitor->analyzeAndGetUpdatedContext(Object(Phan\Language\Context), Object(ast\Node), Object(ast\Node))
#19 /path/to/phan/src/Phan/AST/Visitor/Element.php(142): Phan\BlockAnalysisVisitor->visitIfElem(Object(ast\Node))
#20 /path/to/phan/src/Phan/BlockAnalysisVisitor.php(176): Phan\AST\Visitor\Element::acceptNodeAndKindVisitor(Object(ast\Node), Object(Phan\BlockAnalysisVisitor))
#21 /path/to/phan/src/Phan/BlockAnalysisVisitor.php(247): Phan\BlockAnalysisVisitor->analyzeAndGetUpdatedContext(Object(Phan\Language\Context), Object(ast\Node), Object(ast\Node))
#22 /path/to/phan/src/Phan/BlockAnalysisVisitor.php(417): Phan\BlockAnalysisVisitor->visitBranchedContext(Object(ast\Node))
#23 /path/to/phan/src/Phan/AST/Visitor/Element.php(142): Phan\BlockAnalysisVisitor->visitIf(Object(ast\Node))
#24 /path/to/phan/src/Phan/BlockAnalysisVisitor.php(176): Phan\AST\Visitor\Element::acceptNodeAndKindVisitor(Object(ast\Node), Object(Phan\BlockAnalysisVisitor))
#25 /path/to/phan/src/Phan/BlockAnalysisVisitor.php(122): Phan\BlockAnalysisVisitor->analyzeAndGetUpdatedContext(Object(Phan\Language\Context), Object(ast\Node), Object(ast\Node))
#26 /path/to/phan/src/Phan/AST/Visitor/KindVisitorImplementation.php(315): Phan\BlockAnalysisVisitor->visit(Object(ast\Node))
#27 /path/to/phan/src/Phan/AST/Visitor/Element.php(142): Phan\AST\Visitor\KindVisitorImplementation->visitStmtList(Object(ast\Node))
#28 /path/to/phan/src/Phan/BlockAnalysisVisitor.php(176): Phan\AST\Visitor\Element::acceptNodeAndKindVisitor(Object(ast\Node), Object(Phan\BlockAnalysisVisitor))
#29 /path/to/phan/src/Phan/BlockAnalysisVisitor.php(315): Phan\BlockAnalysisVisitor->analyzeAndGetUpdatedContext(Object(Phan\Language\Context), Object(ast\Node), Object(ast\Node))
#30 /path/to/phan/src/Phan/AST/Visitor/Element.php(142): Phan\BlockAnalysisVisitor->visitIfElem(Object(ast\Node))
#31 /path/to/phan/src/Phan/BlockAnalysisVisitor.php(176): Phan\AST\Visitor\Element::acceptNodeAndKindVisitor(Object(ast\Node), Object(Phan\BlockAnalysisVisitor))
#32 /path/to/phan/src/Phan/BlockAnalysisVisitor.php(247): Phan\BlockAnalysisVisitor->analyzeAndGetUpdatedContext(Object(Phan\Language\Context), Object(ast\Node), Object(ast\Node))
#33 /path/to/phan/src/Phan/BlockAnalysisVisitor.php(417): Phan\BlockAnalysisVisitor->visitBranchedContext(Object(ast\Node))
#34 /path/to/phan/src/Phan/AST/Visitor/Element.php(142): Phan\BlockAnalysisVisitor->visitIf(Object(ast\Node))
#35 /path/to/phan/src/Phan/BlockAnalysisVisitor.php(176): Phan\AST\Visitor\Element::acceptNodeAndKindVisitor(Object(ast\Node), Object(Phan\BlockAnalysisVisitor))
#36 /path/to/phan/src/Phan/BlockAnalysisVisitor.php(122): Phan\BlockAnalysisVisitor->analyzeAndGetUpdatedContext(Object(Phan\Language\Context), Object(ast\Node), Object(ast\Node))
#37 /path/to/phan/src/Phan/AST/Visitor/KindVisitorImplementation.php(315): Phan\BlockAnalysisVisitor->visit(Object(ast\Node))
#38 /path/to/phan/src/Phan/AST/Visitor/Element.php(142): Phan\AST\Visitor\KindVisitorImplementation->visitStmtList(Object(ast\Node))
#39 /path/to/phan/src/Phan/BlockAnalysisVisitor.php(176): Phan\AST\Visitor\Element::acceptNodeAndKindVisitor(Object(ast\Node), Object(Phan\BlockAnalysisVisitor))
#40 /path/to/phan/src/Phan/BlockAnalysisVisitor.php(387): Phan\BlockAnalysisVisitor->analyzeAndGetUpdatedContext(Object(Phan\Language\Context), Object(ast\Node\Decl), Object(ast\Node))
#41 /path/to/phan/src/Phan/BlockAnalysisVisitor.php(540): Phan\BlockAnalysisVisitor->visitClosedContext(Object(ast\Node\Decl))
#42 /path/to/phan/src/Phan/AST/Visitor/Element.php(142): Phan\BlockAnalysisVisitor->visitMethod(Object(ast\Node\Decl))
#43 /path/to/phan/src/Phan/BlockAnalysisVisitor.php(176): Phan\AST\Visitor\Element::acceptNodeAndKindVisitor(Object(ast\Node\Decl), Object(Phan\BlockAnalysisVisitor))
#44 /path/to/phan/src/Phan/BlockAnalysisVisitor.php(122): Phan\BlockAnalysisVisitor->analyzeAndGetUpdatedContext(Object(Phan\Language\Context), Object(ast\Node), Object(ast\Node\Decl))
#45 /path/to/phan/src/Phan/AST/Visitor/KindVisitorImplementation.php(315): Phan\BlockAnalysisVisitor->visit(Object(ast\Node))
#46 /path/to/phan/src/Phan/AST/Visitor/Element.php(142): Phan\AST\Visitor\KindVisitorImplementation->visitStmtList(Object(ast\Node))
#47 /path/to/phan/src/Phan/BlockAnalysisVisitor.php(176): Phan\AST\Visitor\Element::acceptNodeAndKindVisitor(Object(ast\Node), Object(Phan\BlockAnalysisVisitor))
#48 /path/to/phan/src/Phan/BlockAnalysisVisitor.php(387): Phan\BlockAnalysisVisitor->analyzeAndGetUpdatedContext(Object(Phan\Language\Context), Object(ast\Node\Decl), Object(ast\Node))
#49 /path/to/phan/src/Phan/BlockAnalysisVisitor.php(527): Phan\BlockAnalysisVisitor->visitClosedContext(Object(ast\Node\Decl))
#50 /path/to/phan/src/Phan/AST/Visitor/Element.php(142): Phan\BlockAnalysisVisitor->visitClass(Object(ast\Node\Decl))
#51 /path/to/phan/src/Phan/BlockAnalysisVisitor.php(176): Phan\AST\Visitor\Element::acceptNodeAndKindVisitor(Object(ast\Node\Decl), Object(Phan\BlockAnalysisVisitor))
#52 /path/to/phan/src/Phan/BlockAnalysisVisitor.php(122): Phan\BlockAnalysisVisitor->analyzeAndGetUpdatedContext(Object(Phan\Language\Context), Object(ast\Node), Object(ast\Node\Decl))
#53 /path/to/phan/src/Phan/AST/Visitor/KindVisitorImplementation.php(315): Phan\BlockAnalysisVisitor->visit(Object(ast\Node))
#54 /path/to/phan/src/Phan/AST/Visitor/KindVisitorImplementation.php(26): Phan\AST\Visitor\KindVisitorImplementation->visitStmtList(Object(ast\Node))
#55 /path/to/phan/src/Phan/Analysis.php(359): Phan\AST\Visitor\KindVisitorImplementation->__invoke(Object(ast\Node))
#56 /path/to/phan/src/Phan/Phan.php(243): Phan\Analysis::analyzeFile(Object(Phan\CodeBase), 'path/to...', NULL)
#57 /path/to/phan/src/Phan/Phan.php(285): Phan\Phan::Phan\{closure}(0, 'path/to...')