Skip to content

Commit

Permalink
Fix #9363
Browse files Browse the repository at this point in the history
  • Loading branch information
danog committed Feb 21, 2023
1 parent c46eccd commit 575da79
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ public static function analyze(
}

if ($literal_concat) {
(function (int $_): void {
})($combinations);
if (count($result_type_parts) === 0) {
throw new AssertionError("The number of parts cannot be 0!");
}
Expand Down

3 comments on commit 575da79

@alies-dev
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @danog
Thanks for this quick fix! so far it looks like a black magic to me. :) I would love to know more about it and how it helped to bypass the issue. If it's not difficult to you, can you please share some details about the solution?

@danog
Copy link
Collaborator Author

@danog danog commented on 575da79 Feb 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing too complicated, I just noticed that the issue went away when var_dumping the variables, so I assumed that calling any function before that assertion would somehow reorder values on the stack or do something else that bypasses the issue.
I assume I could've digged in some more to find out why this bypasses the issue, but dstogov already fixed the issue upstream so it doesn't really matter, this just a hotfix until php 8.1.17 and 8.2.4 are released, at which point I'll probably add a conflict section to psalm's composer.json to avoid loading broken versions of php.

dstogov/php-src@84cd1cc

@alies-dev
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, thanks a lot for these details! 👍

Please sign in to comment.