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

fix crash in <PHP8 with ResourceBundle #8416

Merged
merged 2 commits into from Sep 23, 2022

Conversation

kkmuffme
Copy link
Contributor

Fix #8346

partially reverts #8217

@AndrolGenhald AndrolGenhald added release:fix The PR will be included in 'Fixes' section of the release notes PR: Needs work labels Aug 16, 2022
@orklah
Copy link
Collaborator

orklah commented Aug 16, 2022

count used to contain ResourceBundle, the previous PR removed it for newer version. I don't think dropping it altogether is the way to go here. We better keep it even on PHP >8

@kkmuffme
Copy link
Contributor Author

kkmuffme commented Sep 8, 2022

@orklah then what do you want me to do here? When I leave "ResourceBundle" in (anywhere), I get a fatal; I must drop ResourceBundle.

The only other solution is go back to the "mixed" it had before that PR, which would be worse I guess.

@orklah
Copy link
Collaborator

orklah commented Sep 11, 2022

count used to have ResourceBundle: https://github.com/vimeo/psalm/pull/8217/files#diff-5611cd00854405fe61befddd211dacd225d9c479b499ffd7e3c0c7d96eb568edR216

The change in #8217 was to remove ResourceBundle in latest php versions definitions. So reverting that would mean still have ResourceBundle on every version like before, not removing it altogether

@kkmuffme kkmuffme force-pushed the regression-4.25.0-count-resourcebundle branch from 5536ce1 to f87b527 Compare September 11, 2022 08:45
@kkmuffme
Copy link
Contributor Author

I didn't do that, as I feared that would still keep the fatal (I cannot reproduce the fatal anymore though, since I don't have access to that environment anymore).
Anyway put it back in historical callmap now.

@AndrolGenhald
Copy link
Collaborator

FWIW I do think ResourceBundle needs removed from the callmap (see here). Referencing extension-defined classes in the callmap in functions not defined by that extension is probably a bad idea. I'm not sure what the best fix is though, a provider for count seems like overkill in this case, but that might be the only way to correctly fix it.

@orklah
Copy link
Collaborator

orklah commented Sep 13, 2022

ouch, I didn't know it was an extension... Let's fix this the way it was and we'll look for a solution after I think

@kkmuffme can you check tests 1 and 4? There's callmap consistencies failures in tests

@kkmuffme kkmuffme force-pushed the regression-4.25.0-count-resourcebundle branch 5 times, most recently from 75ddfbe to 8bcf725 Compare September 21, 2022 22:53
@kkmuffme kkmuffme force-pushed the regression-4.25.0-count-resourcebundle branch from 8bcf725 to 328561d Compare September 21, 2022 23:01
@kkmuffme
Copy link
Contributor Author

@orklah put back what I had originally PRed now and fixed the tests (they were broken bc of a misunderstanding from another PR)

Ready to merge

@@ -519,7 +519,13 @@ public function testIgnoresAreSortedAndUnique(): void
/** @var string */
$function = is_int($key) ? $value : $key;

$this->assertGreaterThan(0, strcmp($function, $previousFunction));
$diff = strcmp($function, $previousFunction);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this on purpose? Won't PHPUnit scream if there are outputs in a test?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. Because the error message with just the assert is useless, as it doesn't tell you which function is duplicate/in wrong order.

Yes, phpunit will give an error IF there is output - but that's the purpose of this - if it will fail the assertGreaterThan anyway, it might as well just tell me which function causes it to fail, so I can easily fix it.

@orklah
Copy link
Collaborator

orklah commented Sep 23, 2022

Thanks!

@orklah orklah merged commit b55fc2b into vimeo:4.x Sep 23, 2022
@kkmuffme kkmuffme deleted the regression-4.25.0-count-resourcebundle branch September 24, 2022 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: Needs work release:fix The PR will be included in 'Fixes' section of the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4.25.0 Regression: Could not get class storage for resourcebundle for PHP < 8.0
3 participants