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

AssertionError assert(count($result_type_parts) === $combinations) #9285

Closed
alies-dev opened this issue Feb 13, 2023 · 13 comments · Fixed by #9318
Closed

AssertionError assert(count($result_type_parts) === $combinations) #9285

alies-dev opened this issue Feb 13, 2023 · 13 comments · Fixed by #9318

Comments

@alies-dev
Copy link
Contributor

Today I tried to update Psalm to the latest dev-master 1be367b, from 3584826 and caught an issue that I couldn't reproduce on psalm.dev

stack:

Uncaught Exception: AssertionError assert(count($result_type_parts) === $combinations)
Emitted in ...repo/tools/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ConcatAnalyzer.php:181
Stack trace in the forked worker:
#0 ...repo/tools/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ConcatAnalyzer.php(181): assert(false, 'assert(count($r...')
#1 ...repo/tools/psalm/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\Scalar\String_), Object(PhpParser\Node\Expr\ClassConstFetch), Object(Psalm\Context), Object(Psalm\Type\Union))
#2 ...repo/tools/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/ExpressionAnalyzer.php(265): Psalm\Internal\Analyzer\Statements\Expression\BinaryOpAnalyzer::analyze(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(PhpParser\Node\Expr\BinaryOp\Concat), Object(Psalm\Context), 0, false)
#3 ...repo/tools/psalm/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\BinaryOp\Concat), Object(Psalm\Context), false, NULL, false, NULL, false)
#4 ...repo/tools/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/Expression/ArrayAnalyzer.php(355): Psalm\Internal\Analyzer\Statements\ExpressionAnalyzer::analyze(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(PhpParser\Node\Expr\BinaryOp\Concat), Object(Psalm\Context))
#5 ...repo/tools/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/Expression/ArrayAnalyzer.php(87): Psalm\Internal\Analyzer\Statements\Expression\ArrayAnalyzer::analyzeArrayItem(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(Psalm\Context), Object(Psalm\Internal\Analyzer\Statements\Expression\ArrayCreationInfo), Object(PhpParser\Node\Expr\ArrayItem), Object(Psalm\Codebase))
#6 ...repo/tools/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/ExpressionAnalyzer.php(287): Psalm\Internal\Analyzer\Statements\Expression\ArrayAnalyzer::analyze(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(PhpParser\Node\Expr\Array_), Object(Psalm\Context))
#7 ...repo/tools/psalm/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\Array_), Object(Psalm\Context), false, NULL, false, NULL, false)
#8 ...repo/tools/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/Expression/ArrayAnalyzer.php(355): Psalm\Internal\Analyzer\Statements\ExpressionAnalyzer::analyze(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(PhpParser\Node\Expr\Array_), Object(Psalm\Context))
#9 ...repo/tools/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/Expression/ArrayAnalyzer.php(87): Psalm\Internal\Analyzer\Statements\Expression\ArrayAnalyzer::analyzeArrayItem(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(Psalm\Context), Object(Psalm\Internal\Analyzer\Statements\Expression\ArrayCreationInfo), Object(PhpParser\Node\Expr\ArrayItem), Object(Psalm\Codebase))
#10 ...repo/tools/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/ExpressionAnalyzer.php(287): Psalm\Internal\Analyzer\Statements\Expression\ArrayAnalyzer::analyze(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(PhpParser\Node\Expr\Array_), Object(Psalm\Context))
#11 ...repo/tools/psalm/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\Array_), Object(Psalm\Context), false, NULL, false, NULL, false)
#12 ...repo/tools/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/Expression/AssignmentAnalyzer.php(242): Psalm\Internal\Analyzer\Statements\ExpressionAnalyzer::analyze(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(PhpParser\Node\Expr\Array_), Object(Psalm\Context))
#13 ...repo/tools/psalm/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(PhpParser\Node\Expr\Array_), NULL, Object(Psalm\Context), Object(PhpParser\Comment\Doc), Array, NULL)
#14 ...repo/tools/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/ExpressionAnalyzer.php(178): Psalm\Internal\Analyzer\Statements\ExpressionAnalyzer::analyzeAssignment(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(PhpParser\Node\Expr\Assign), Object(Psalm\Context), true)
#15 ...repo/tools/psalm/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\Assign), Object(Psalm\Context), false, Object(Psalm\Context), true, NULL, false)
#16 ...repo/tools/psalm/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\Assign), Object(Psalm\Context), false, Object(Psalm\Context), true)
#17 ...repo/tools/psalm/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), Object(Psalm\Context))
#18 ...repo/tools/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php(459): Psalm\Internal\Analyzer\StatementsAnalyzer->analyze(Array, Object(Psalm\Context), Object(Psalm\Context), true)
#19 ...repo/tools/psalm/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))
#20 ...repo/tools/psalm/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), Object(Psalm\Context))
#21 ...repo/tools/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/FileAnalyzer.php(203): Psalm\Internal\Analyzer\ClassAnalyzer->analyze(Object(Psalm\Context), Object(Psalm\Context))
#22 ...repo/tools/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Analyzer.php(1581): Psalm\Internal\Analyzer\FileAnalyzer->analyze()
#23 ...repo/tools/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Fork/Pool.php(209): Psalm\Internal\Codebase\Analyzer->analysisWorker(0, '/Users/alies/co...')
#24 ...repo/tools/psalm/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))
#25 ...repo/tools/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Analyzer.php(272): Psalm\Internal\Codebase\Analyzer->doAnalysis(Object(Psalm\Internal\Analyzer\ProjectAnalyzer), 9)
#26 ...repo/tools/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php(665): Psalm\Internal\Codebase\Analyzer->analyzeFiles(Object(Psalm\Internal\Analyzer\ProjectAnalyzer), 9, false, true)
#27 ...repo/tools/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Cli/Psalm.php(369): Psalm\Internal\Analyzer\ProjectAnalyzer->check('/Users/alies/co...', true)
#28 ...repo/tools/psalm/vendor/vimeo/psalm/psalm(9): Psalm\Internal\Cli\Psalm::run(Array)
#29 ...repo/tools/psalm/vendor/bin/psalm(120): include('/Users/alies/co...')
#30 {main} in ...repo/tools/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Fork/Pool.php:397
Stack trace:
#0 ...repo/tools/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Fork/Pool.php(431): Psalm\Internal\Fork\Pool->readResultsFromChildren()
#1 ...repo/tools/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Analyzer.php(406): Psalm\Internal\Fork\Pool->wait()
#2 ...repo/tools/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Analyzer.php(272): Psalm\Internal\Codebase\Analyzer->doAnalysis(Object(Psalm\Internal\Analyzer\ProjectAnalyzer), 9)
#3 ...repo/tools/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php(665): Psalm\Internal\Codebase\Analyzer->analyzeFiles(Object(Psalm\Internal\Analyzer\ProjectAnalyzer), 9, false, true)
#4 ...repo/tools/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Cli/Psalm.php(369): Psalm\Internal\Analyzer\ProjectAnalyzer->check('/Users/alies/co...', true)
#5 ...repo/tools/psalm/vendor/vimeo/psalm/psalm(9): Psalm\Internal\Cli\Psalm::run(Array)
#6 ...repo/tools/psalm/vendor/bin/psalm(120): include('/Users/alies/co...')
#7 {main}
(Psalm dev-master@1be367bc06a12fb08a1cef6862f4c9a50f36fa3b crashed due to an uncaught Throwable)

Laravel code where it failed:

public function show(Request $request, SchedulesByLevelClosingTomorrowOrLaterQuery $scheduleQuery): JsonResponse
{
    $publicationType = $request->input('publicationType');
    $publicationId = $request->input('publicationId');

    $publication = null;
    if ($publicationType === 'article') {
        $publication = Article::query()->findOrFail($publicationId);
    } elseif ($publicationType === 'book-chapter') {
        $publication = BookChapter::query()->findOrFail($publicationId);
    } else {
        /** abort without a valid publication */
        abort(Response::HTTP_NOT_FOUND, 'Content not found.');
    }

    assert($publication instanceof Taggable);

    $courseSchedules = $this->getCourseSchedulesForAds($publication, $scheduleQuery);

    $htmlCode = view()->make('pages.course.__coursesAdsBlockInjection', [
        'courseSchedules' => $courseSchedules,
    ])->render();

    return response()->json(['html' => $htmlCode]);
}

Namely on line $publication = Article::query()->findOrFail($publicationId);

Laravel plugin is not installed

Snippet where I could reproduce it (even if I define classes): https://psalm.dev/r/78d9b454f0

@psalm-github-bot
Copy link

I found these snippets:

https://psalm.dev/r/78d9b454f0
<?php

class Request {
    public function input(string $name): mixed
    {
        return $_POST[$name] ?? null;
    }
}

function show(Request $request): void
{
    $publicationType = $request->input('publicationType');
    $publicationId = $request->input('publicationId');

    $publication = null;
    if ($publicationType === 'article') {
        $publication = Article::query()->findOrFail($publicationId);
    } elseif ($publicationType === 'book-chapter') {
        $publication = BookChapter::query()->findOrFail($publicationId);
    } else {
        /** abort without a valid publication */
        abort(Response::HTTP_NOT_FOUND, 'Content not found.');
    }

    assert($publication instanceof Taggable);
}
Psalm output (using commit 1be367b):

INFO: MixedAssignment - 12:5 - Unable to determine the type that $publicationType is being assigned to

INFO: MixedAssignment - 13:5 - Unable to determine the type that $publicationId is being assigned to

ERROR: UndefinedClass - 17:24 - Class, interface or enum named Article does not exist

@weirdan
Copy link
Collaborator

weirdan commented Feb 13, 2023

Stack trace suggests something different. Namely, it appears Psalm was analyzing an expression like "some string" . ClassName::SOME_CONSTANT

@alies-dev
Copy link
Contributor Author

I got the same issue today on running composer psalm on this repository, dev-master dd13930

PHP 8.1.14 (cli)

Getting code/psalm/src/Psalm/Internal/Analyzer/Statements/Block/IfConditionalAnalyzer.php
Analyzing code/psalm/src/Psalm/Internal/Analyzer/Statements/Block/IfConditionalAnalyzer.php
code/psalm/psalm:8
Uncaught Exception: AssertionError assert(count($result_type_parts) === $combinations)
Emitted in code/psalm/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ConcatAnalyzer.php:181
Stack trace in the forked worker:
#0 code/psalm/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ConcatAnalyzer.php(181): assert(false, 'assert(count($r...')
#1 code/psalm/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOpAnalyzer.php(139): Psalm\Internal\Analyzer\Statements\Expression\BinaryOp\ConcatAnalyzer::analyze(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(PhpParser\Node\Scalar\MagicConst\Dir), Object(PhpParser\Node\Scalar\String_), Object(Psalm\Context), Object(Psalm\Type\Union))
#2 code/psalm/src/Psalm/Internal/Analyzer/Statements/ExpressionAnalyzer.php(266): Psalm\Internal\Analyzer\Statements\Expression\BinaryOpAnalyzer::analyze(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(PhpParser\Node\Expr\BinaryOp\Concat), Object(Psalm\Context), 0, false)
#3 code/psalm/src/Psalm/Internal/Analyzer/Statements/ExpressionAnalyzer.php(86): Psalm\Internal\Analyzer\Statements\ExpressionAnalyzer::handleExpression(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(PhpParser\Node\Expr\BinaryOp\Concat), Object(Psalm\Context), false, NULL, false, NULL, false)
#4 code/psalm/src/Psalm/Internal/Analyzer/Statements/Expression/IncludeAnalyzer.php(71): Psalm\Internal\Analyzer\Statements\ExpressionAnalyzer::analyze(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(PhpParser\Node\Expr\BinaryOp\Concat), Object(Psalm\Context))
#5 code/psalm/src/Psalm/Internal/Analyzer/Statements/ExpressionAnalyzer.php(348): Psalm\Internal\Analyzer\Statements\Expression\IncludeAnalyzer::analyze(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(PhpParser\Node\Expr\Include_), Object(Psalm\Context), NULL)
#6 code/psalm/src/Psalm/Internal/Analyzer/Statements/ExpressionAnalyzer.php(86): Psalm\Internal\Analyzer\Statements\ExpressionAnalyzer::handleExpression(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(PhpParser\Node\Expr\Include_), Object(Psalm\Context), false, NULL, true, NULL, false)
#7 code/psalm/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php(566): Psalm\Internal\Analyzer\Statements\ExpressionAnalyzer::analyze(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(PhpParser\Node\Expr\Include_), Object(Psalm\Context), false, NULL, true)
#8 code/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)
#9 code/psalm/src/Psalm/Internal/Analyzer/NamespaceAnalyzer.php(94): Psalm\Internal\Analyzer\StatementsAnalyzer->analyze(Array, Object(Psalm\Context), NULL, true)
#10 code/psalm/src/Psalm/Internal/Analyzer/FileAnalyzer.php(289): Psalm\Internal\Analyzer\NamespaceAnalyzer->collectAnalyzableInformation()
#11 code/psalm/src/Psalm/Internal/Analyzer/FileAnalyzer.php(167): Psalm\Internal\Analyzer\FileAnalyzer->populateCheckers(Array)
#12 code/psalm/src/Psalm/Internal/Codebase/Analyzer.php(1581): Psalm\Internal\Analyzer\FileAnalyzer->analyze()
#13 code/psalm/src/Psalm/Internal/Fork/Pool.php(209): Psalm\Internal\Codebase\Analyzer->analysisWorker(0, '/Users/alies/co...')
#14 code/psalm/src/Psalm/Internal/Codebase/Analyzer.php(373): Psalm\Internal\Fork\Pool->__construct(Object(Psalm\Config), Array, Object(Closure), Object(Closure), Object(Closure), Object(Closure))
#15 code/psalm/src/Psalm/Internal/Codebase/Analyzer.php(272): Psalm\Internal\Codebase\Analyzer->doAnalysis(Object(Psalm\Internal\Analyzer\ProjectAnalyzer), 9)
#16 code/psalm/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php(669): Psalm\Internal\Codebase\Analyzer->analyzeFiles(Object(Psalm\Internal\Analyzer\ProjectAnalyzer), 9, false, true)
#17 code/psalm/src/Psalm/Internal/Cli/Psalm.php(372): Psalm\Internal\Analyzer\ProjectAnalyzer->check('/Users/alies/co...', true)
#18 code/psalm/psalm(9): Psalm\Internal\Cli\Psalm::run(Array)
#19 {main} in code/psalm/src/Psalm/Internal/Fork/Pool.php:397
Stack trace:
#0 code/psalm/src/Psalm/Internal/Fork/Pool.php(431): Psalm\Internal\Fork\Pool->readResultsFromChildren()
#1 code/psalm/src/Psalm/Internal/Codebase/Analyzer.php(406): Psalm\Internal\Fork\Pool->wait()
#2 code/psalm/src/Psalm/Internal/Codebase/Analyzer.php(272): Psalm\Internal\Codebase\Analyzer->doAnalysis(Object(Psalm\Internal\Analyzer\ProjectAnalyzer), 9)
#3 code/psalm/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php(669): Psalm\Internal\Codebase\Analyzer->analyzeFiles(Object(Psalm\Internal\Analyzer\ProjectAnalyzer), 9, false, true)
#4 code/psalm/src/Psalm/Internal/Cli/Psalm.php(372): Psalm\Internal\Analyzer\ProjectAnalyzer->check('/Users/alies/co...', true)
#5 code/psalm/psalm(9): Psalm\Internal\Cli\Psalm::run(Array)
#6 {main}
(Psalm dev-master@dd1393005d8139c752e469de7a94493308f6780e crashed due to an uncaught Throwable)

@alies-dev
Copy link
Contributor Author

alies-dev commented Feb 17, 2023

interesting, I still have this issue on both locally installed PHP version (8.1.15, 8.2.2, macOS, installed using brew).

I decided to debug it a bit, added a custom assertion message like this:

assert(count($result_type_parts) === $combinations, sprintf("%s(%s) & %s(%s)", count($result_type_parts), get_debug_type(count($result_type_parts)), $combinations, get_debug_type($combinations)));

And output is:

Uncaught Exception: AssertionError 1(int) & 1(int)
Emitted in
...code/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ConcatAnalyzer.php:181
Stack trace in the forked worker:
#0 ...code/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/ConcatAnalyzer.php(181): assert(false, '1(int) & 1(int)')

I'm not even sure where to report it - to PHP, to brew or other places? 🤯

On Docker instances of PHP it works fine

@weirdan
Copy link
Collaborator

weirdan commented Feb 17, 2023

To https://github.com/php/php-src/, I suppose, but you'll need a better reproducer. One thing that's worth checking is reducing the set of extensions used to the bare minimum (see below)

// the following list was taken from vendor/composer/platform_check.php
// It includes both Psalm's requirements (from composer.json) and the
// requirements of our dependencies `netresearch/jsonmapper` and
// `phpdocumentor/reflection-docblock`. The latter is transitive
// dependency of `felixfbecker/advanced-json-rpc`
$required_extensions = [
'dom',
'filter',
'json',
'libxml',
'pcre',
'reflection',
'simplexml',
'spl',
'tokenizer',
];

@pereorga
Copy link
Contributor

FWIW, I am having the same issue on Mac (8.1.15, 8.2.3) when using psalm 5.7.0/5.7.1.

On Linux (8.1.15), it works fine.

Psalm 5.6.0 also works fine on both platforms.

@danog
Copy link
Collaborator

danog commented Feb 20, 2023

Already reported to php/php-src#10635, a workaround for psalm is present in #9351 and should be tagged as 5.7.2

@weirdan
Copy link
Collaborator

weirdan commented Feb 20, 2023

The fix is released in 5.7.2.

@pereorga
Copy link
Contributor

Does this workaround address the issue for everybody? I'm still experiencing this error message in 5.7.4.

@danog
Copy link
Collaborator

danog commented Feb 21, 2023

@pereorga Mind opening a new issue with a reproducer?

@alies-dev
Copy link
Contributor Author

5.7.4: I also still have it:

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

@danog
Copy link
Collaborator

danog commented Feb 21, 2023

OK #9364 should fix it for sure, it's weird that when I tested the AssertionError version on arm64 yesterday it didn't trigger the bug, but today it does.

#9364 should fix it properly, I hope (I did test it again on arm64 and it seemed to work :P).

@danog
Copy link
Collaborator

danog commented Feb 21, 2023

Either way the bug will be fixed directly inside of PHP itself in PHP 8.1.17, 8.2.4.

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

Successfully merging a pull request may close this issue.

4 participants