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

Uncaught Exception: AssertionError The number of parts does not match! #9363

Closed
gcg opened this issue Feb 21, 2023 · 4 comments
Closed

Uncaught Exception: AssertionError The number of parts does not match! #9363

gcg opened this issue Feb 21, 2023 · 4 comments

Comments

@gcg
Copy link

gcg commented Feb 21, 2023

Hey there,

So I can't update psalm to 5.7.x due to this error.

image

full stack trace

Target PHP version: 8.2 (inferred from current PHP version).
Scanning files...
Analyzing files...

Uncaught Exception: AssertionError The number of parts does not match!
Emitted in /Users/gcg/Work/src/github.com/Poltio/api1/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ConcatAnalyzer.php:196
Stack trace in the forked worker:
#0 /Users/gcg/Work/src/github.com/Poltio/api1/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOpAnalyzer.php(138): Psalm\Internal\Analyzer\Statements\Expression\BinaryOp\ConcatAnalyzer::analyze(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(PhpParser\Node\Expr\Variable), Object(PhpParser\Node
\Scalar\String_), Object(Psalm\Context), Object(Psalm\Type\Union))
#1 /Users/gcg/Work/src/github.com/Poltio/api1/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/ExpressionAnalyzer.php(265): Psalm\Internal\Analyzer\Statements\Expression\BinaryOpAnalyzer::analyze(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(Psalm\Node\Expr\BinaryOp\VirtualConcat), Object(Psalm\Context), 0, f
alse)
#2 /Users/gcg/Work/src/github.com/Poltio/api1/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/ExpressionAnalyzer.php(85): Psalm\Internal\Analyzer\Statements\ExpressionAnalyzer::handleExpression(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(Psalm\Node\Expr\BinaryOp\VirtualConcat), Object(Psalm\Context), false
, NULL, false, NULL, false)
#3 /Users/gcg/Work/src/github.com/Poltio/api1/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/Expression/AssignmentAnalyzer.php(242): Psalm\Internal\Analyzer\Statements\ExpressionAnalyzer::analyze(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(Psalm\Node\Expr\BinaryOp\VirtualConcat), Object(Psalm\Context))
#4 /Users/gcg/Work/src/github.com/Poltio/api1/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/ExpressionAnalyzer.php(536): Psalm\Internal\Analyzer\Statements\Expression\AssignmentAnalyzer::analyze(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(PhpParser\Node\Expr\Variable), Object(Psalm\Node\Expr\BinaryOp\Vir
tualConcat), NULL, Object(Psalm\Context), NULL, Array, Object(Psalm\Node\Expr\VirtualAssign))
#5 /Users/gcg/Work/src/github.com/Poltio/api1/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/ExpressionAnalyzer.php(178): Psalm\Internal\Analyzer\Statements\ExpressionAnalyzer::analyzeAssignment(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(Psalm\Node\Expr\VirtualAssign), Object(Psalm\Context), false)
#6 /Users/gcg/Work/src/github.com/Poltio/api1/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/ExpressionAnalyzer.php(85): Psalm\Internal\Analyzer\Statements\ExpressionAnalyzer::handleExpression(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(Psalm\Node\Expr\VirtualAssign), Object(Psalm\Context), false, NULL, f
alse, NULL, false)
#7 /Users/gcg/Work/src/github.com/Poltio/api1/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/Expression/AssignmentAnalyzer.php(881): Psalm\Internal\Analyzer\Statements\ExpressionAnalyzer::analyze(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(Psalm\Node\Expr\VirtualAssign), Object(Psalm\Context))
#8 /Users/gcg/Work/src/github.com/Poltio/api1/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/ExpressionAnalyzer.php(182): Psalm\Internal\Analyzer\Statements\Expression\AssignmentAnalyzer::analyzeAssignmentOperation(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(PhpParser\Node\Expr\AssignOp\Concat), Object(Ps
alm\Context))
#9 /Users/gcg/Work/src/github.com/Poltio/api1/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/ExpressionAnalyzer.php(85): Psalm\Internal\Analyzer\Statements\ExpressionAnalyzer::handleExpression(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(PhpParser\Node\Expr\AssignOp\Concat), Object(Psalm\Context), false, N
ULL, true, NULL, false)
#10 /Users/gcg/Work/src/github.com/Poltio/api1/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php(560): Psalm\Internal\Analyzer\Statements\ExpressionAnalyzer::analyze(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(PhpParser\Node\Expr\AssignOp\Concat), Object(Psalm\Context), false, NULL, true)
#11 /Users/gcg/Work/src/github.com/Poltio/api1/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php(195): Psalm\Internal\Analyzer\StatementsAnalyzer::analyzeStatement(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(PhpParser\Node\Stmt\Expression), Object(Psalm\Context), NULL)
#12 /Users/gcg/Work/src/github.com/Poltio/api1/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/Block/IfElse/IfAnalyzer.php(161): Psalm\Internal\Analyzer\StatementsAnalyzer->analyze(Array, Object(Psalm\Context))
#13 /Users/gcg/Work/src/github.com/Poltio/api1/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/Block/IfElseAnalyzer.php(260): Psalm\Internal\Analyzer\Statements\Block\IfElse\IfAnalyzer::analyze(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(PhpParser\Node\Stmt\If_), Object(Psalm\Internal\Scope\IfScope), Objec
t(Psalm\Internal\Scope\IfConditionalScope), Object(Psalm\Context), Object(Psalm\Context), Array)
#14 /Users/gcg/Work/src/github.com/Poltio/api1/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php(514): Psalm\Internal\Analyzer\Statements\Block\IfElseAnalyzer::analyze(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(PhpParser\Node\Stmt\If_), Object(Psalm\Context))
#15 /Users/gcg/Work/src/github.com/Poltio/api1/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php(195): Psalm\Internal\Analyzer\StatementsAnalyzer::analyzeStatement(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(PhpParser\Node\Stmt\If_), Object(Psalm\Context), Object(Psalm\Context))
#16 /Users/gcg/Work/src/github.com/Poltio/api1/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php(468): Psalm\Internal\Analyzer\StatementsAnalyzer->analyze(Array, Object(Psalm\Context), Object(Psalm\Context), true)
#17 /Users/gcg/Work/src/github.com/Poltio/api1/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/ClassAnalyzer.php(1796): Psalm\Internal\Analyzer\FunctionLikeAnalyzer->analyze(Object(Psalm\Context), Object(Psalm\Internal\Provider\NodeDataProvider), Object(Psalm\Context))
#18 /Users/gcg/Work/src/github.com/Poltio/api1/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/ClassAnalyzer.php(425): Psalm\Internal\Analyzer\ClassAnalyzer->analyzeClassMethod(Object(PhpParser\Node\Stmt\ClassMethod), Object(Psalm\Storage\ClassLikeStorage), Object(Psalm\Internal\Analyzer\ClassAnalyzer), Object(Psalm\Context), Objec
t(Psalm\Context))
#19 /Users/gcg/Work/src/github.com/Poltio/api1/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/FileAnalyzer.php(203): Psalm\Internal\Analyzer\ClassAnalyzer->analyze(Object(Psalm\Context), Object(Psalm\Context))
#20 /Users/gcg/Work/src/github.com/Poltio/api1/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Analyzer.php(1581): Psalm\Internal\Analyzer\FileAnalyzer->analyze()
#21 /Users/gcg/Work/src/github.com/Poltio/api1/vendor/vimeo/psalm/src/Psalm/Internal/Fork/Pool.php(209): Psalm\Internal\Codebase\Analyzer->analysisWorker(0, '/Users/gcg/Work...')
#22 /Users/gcg/Work/src/github.com/Poltio/api1/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Analyzer.php(372): Psalm\Internal\Fork\Pool->__construct(Object(Psalm\Config), Array, Object(Closure), Object(Closure), Object(Closure), Object(Closure))
#23 /Users/gcg/Work/src/github.com/Poltio/api1/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Analyzer.php(272): Psalm\Internal\Codebase\Analyzer->doAnalysis(Object(Psalm\Internal\Analyzer\ProjectAnalyzer), 9)
#24 /Users/gcg/Work/src/github.com/Poltio/api1/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php(665): Psalm\Internal\Codebase\Analyzer->analyzeFiles(Object(Psalm\Internal\Analyzer\ProjectAnalyzer), 9, false, true)
#25 /Users/gcg/Work/src/github.com/Poltio/api1/vendor/vimeo/psalm/src/Psalm/Internal/Cli/Psalm.php(372): Psalm\Internal\Analyzer\ProjectAnalyzer->check('/Users/gcg/Work...', true)
#26 /Users/gcg/Work/src/github.com/Poltio/api1/vendor/vimeo/psalm/psalm(9): Psalm\Internal\Cli\Psalm::run(Array)
#27 /Users/gcg/Work/src/github.com/Poltio/api1/vendor/bin/psalm(120): include('/Users/gcg/Work...')
#28 {main} in /Users/gcg/Work/src/github.com/Poltio/api1/vendor/vimeo/psalm/src/Psalm/Internal/Fork/Pool.php:397
Stack trace:
#0 /Users/gcg/Work/src/github.com/Poltio/api1/vendor/vimeo/psalm/src/Psalm/Internal/Fork/Pool.php(431): Psalm\Internal\Fork\Pool->readResultsFromChildren()
#1 /Users/gcg/Work/src/github.com/Poltio/api1/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Analyzer.php(406): Psalm\Internal\Fork\Pool->wait()
#2 /Users/gcg/Work/src/github.com/Poltio/api1/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Analyzer.php(272): Psalm\Internal\Codebase\Analyzer->doAnalysis(Object(Psalm\Internal\Analyzer\ProjectAnalyzer), 9)
#3 /Users/gcg/Work/src/github.com/Poltio/api1/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php(665): Psalm\Internal\Codebase\Analyzer->analyzeFiles(Object(Psalm\Internal\Analyzer\ProjectAnalyzer), 9, false, true)
#4 /Users/gcg/Work/src/github.com/Poltio/api1/vendor/vimeo/psalm/src/Psalm/Internal/Cli/Psalm.php(372): Psalm\Internal\Analyzer\ProjectAnalyzer->check('/Users/gcg/Work...', true)
#5 /Users/gcg/Work/src/github.com/Poltio/api1/vendor/vimeo/psalm/psalm(9): Psalm\Internal\Cli\Psalm::run(Array)
#6 /Users/gcg/Work/src/github.com/Poltio/api1/vendor/bin/psalm(120): include('/Users/gcg/Work...')
#7 {main}
(Psalm 5.7.4@c46eccda769925073b8f65d66c4a3a7dc5d440b1 crashed due to an uncaught Throwable)

I tried with 5.7.0 5.7.1 and now today with 5.7.4 same thing.

I am on apple silicon with php 8.2 (PHP 8.2.3 (cli) (built: Feb 15 2023 00:18:01) (NTS))

And the funny thing is, I added var_dump to the file/variables throwing this error:

image

image

Am I just missing something silly or shouldnt int(1) !== int(1) supposed to return false instead of true like it does here

I am trying to fiddle it out but if anyone has more experience and can point a finger to something that i am failing to see, that will be much appriciated.

@psalm-github-bot
Copy link

Hey @gcg, can you reproduce the issue on https://psalm.dev ?

@gcg
Copy link
Author

gcg commented Feb 21, 2023

Hey @gcg, can you reproduce the issue on https://psalm.dev ?

hey bot, the error seems to be coming from psalm directly, not because of my code.

but i did check on a different codebase/project on the same machine just to be safe, updated psalm from 5.6 to 5.7.4 and got the same error.

image

@gcg
Copy link
Author

gcg commented Feb 21, 2023

As an update, can't replicate this on the same php version with a x86 linux.

image

@danog
Copy link
Collaborator

danog commented Feb 21, 2023

Yes, this is a known PHP bug, it was fixed by php/php-src@70ff10a and will be released in PHP 8.2.4 and 8.1.17.

In the meantime #9364 should provide a userland hotfix.

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

No branches or pull requests

2 participants