Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Intl] Remove incorrect condition inCurrencyDataGenerator::icuPairToDate#61681
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
…Date1 << 63 === PHP_INT_MIN we cannot have a lower int value1 << 64 === 0 so the removing this value doesn't change anythingFix psalm crash due to bugvimeo/psalm#11209When doing PHP_INT_MIN - 1, the value is converted to a float that breaks the type system of psalmhttps://github.com/vimeo/psalm/blob/279f3eab037923d3f9d3ea3de1a16b425653e30c/src/Psalm/Internal/Type/SimpleAssertionReconciler.php#L2073
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Pull Request Overview
This PR fixes a psalm analysis issue by removing an unnecessary condition in theCurrencyDataGenerator::icuPairToDate method that was causing static analysis to crash. The removed condition was mathematically redundant since1 << 63 === PHP_INT_MIN represents the lowest possible integer value, and1 << 64 === 0, making the subtraction operation meaningless.
- Removes redundant signed/unsigned 64-bit integer conversion logic
- Fixes psalm static analysis crash related to integer overflow handling
- Maintains existing functionality while improving code analysis compatibility
Tip: Customize your code reviews with copilot-instructions.md.Create the file orlearn how to get started.
Crovitche-1623 commentedSep 8, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Thanks@GromNaN The fix seems correct to me. PHP seems to store the sign in the last bit. Therefore, when we do 1 << 63, PHP automatically transforms the value to a float instead of going in negative values for safety purpose. That was probably the reason why psalm was failing As you said, this is not an issue if we have a float for the following calculations as long as we don't reach the value (1 << 62) /1000 + 1 |
nicolas-grekas commentedSep 8, 2025
Thank you@GromNaN. |
1f64ca9 intosymfony:6.4Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Remove a useless condition that breaks psalm analysis.
1 << 63 === PHP_INT_MINwe cannot have a lower int value1 << 64 === 0so the removing this value doesn't change anythingFix psalm crash due to bugvimeo/psalm#11209
When
PHP_INT_MIN - 1, the value is converted to a float that breaks the type system of psalmhttps://github.com/vimeo/psalm/blob/279f3eab037923d3f9d3ea3de1a16b425653e30c/src/Psalm/Internal/Type/SimpleAssertionReconciler.php#L2073Dealing with timestamp
>= (1 << 62)/1000will be necessary when we reachyear 146140482.