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

Crash when resolving condition #3133

Closed
LeSuisse opened this issue Apr 13, 2020 · 1 comment
Closed

Crash when resolving condition #3133

LeSuisse opened this issue Apr 13, 2020 · 1 comment
Labels

Comments

@LeSuisse
Copy link
Contributor

Just encountered a crash while updating to Psalm 3.11.1.

https://psalm.dev/r/eba2823198

<?php

$a = [];
$b = [];
if (! isset($b['id'], $a[$b['id']])) {
    echo 'z';
}
PHP Notice:  Trying to get property 'wedge' of non-object in /workspace/vendor/vimeo/psalm/src/Psalm/Type/Algebra.php on line 561
PHP Notice:  Trying to get property 'impossibilities' of non-object in /workspace/vendor/vimeo/psalm/src/Psalm/Type/Algebra.php on line 562

Notice: Trying to get property 'wedge' of non-object in /workspace/vendor/vimeo/psalm/src/Psalm/Type/Algebra.php on line 561

Notice: Trying to get property 'impossibilities' of non-object in /workspace/vendor/vimeo/psalm/src/Psalm/Type/Algebra.php on line 562
Uncaught UnexpectedValueException: $clause->impossibilities should not be null in /workspace/vendor/vimeo/psalm/src/Psalm/Type/Algebra.php:563
Stack trace:
#0 /workspace/vendor/vimeo/psalm/src/Psalm/Type/Algebra.php(766): Psalm\Type\Algebra::groupImpossibilities(Array)
#1 /workspace/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/AlgebraAnalyzer.php(44): Psalm\Type\Algebra::negateFormula(Array)
#2 /workspace/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/Block/IfAnalyzer.php(150): Psalm\Internal\Analyzer\AlgebraAnalyzer::checkForParadox(Array, Array, Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(PhpParser\Node\Expr\BooleanNot), Array)
#3 /workspace/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php(374): Psalm\Internal\Analyzer\Statements\Block\IfAnalyzer::analyze(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(PhpParser\Node\Stmt\If_), Object(Psalm\Context))
#4 /workspace/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/FileAnalyzer.php(190): Psalm\Internal\Analyzer\StatementsAnalyzer->analyze(Array, Object(Psalm\Context), NULL, true)
#5 /workspace/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Analyzer.php(357): Psalm\Internal\Analyzer\FileAnalyzer->analyze(NULL)
#6 /workspace/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Analyzer.php(589): Psalm\Internal\Codebase\Analyzer->Psalm\Internal\Codebase\{closure}(0, '...')
#7 /workspace/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Analyzer.php(267): Psalm\Internal\Codebase\Analyzer->doAnalysis(Object(Psalm\Internal\Analyzer\ProjectAnalyzer), 15)
#8 /workspace/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php(1146): Psalm\Internal\Codebase\Analyzer->analyzeFiles(Object(Psalm\Internal\Analyzer\ProjectAnalyzer), 15, false, false)
#9 /workspace/vendor/vimeo/psalm/src/psalm.php(590): Psalm\Internal\Analyzer\ProjectAnalyzer->checkPaths(Array)
#10 /workspace/vendor/vimeo/psalm/psalm(2): require_once('...')
#11 {main}
(Psalm 3.11.1@8533b866ab1a46e5a69a4692ff57f10529dbfbeb crashed due to an uncaught Throwable)
@psalm-github-bot
Copy link

I found these snippets:

https://psalm.dev/r/eba2823198
<?php

$a = [];
$b = [];
if (! isset($b['id'], $a[$b['id']])) {
    echo 'z';
}
Psalm encountered an internal error:

/vendor/vimeo/psalm/src/Psalm/Type/Algebra.php: $clause->impossibilities should not be null

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

No branches or pull requests

2 participants