Skip to content

Commit 1f64ca9

Browse files
minor symfony#61681 [Intl] Remove incorrect condition in CurrencyDataGenerator::icuPairToDate (GromNaN)
This PR was merged into the 6.4 branch. Discussion ---------- [Intl] Remove incorrect condition in `CurrencyDataGenerator::icuPairToDate` | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix symfony#61556 (comment) | License | MIT Remove a useless condition that breaks psalm analysis. - `1 << 63 === PHP_INT_MIN` we cannot have a lower int value - `1 << 64 === 0` so the removing this value doesn't change anything Fix psalm crash due to bug vimeo/psalm#11209 When `PHP_INT_MIN - 1`, the value is converted to a float that breaks the type system of psalm https://github.com/vimeo/psalm/blob/279f3eab037923d3f9d3ea3de1a16b425653e30c/src/Psalm/Internal/Type/SimpleAssertionReconciler.php#L2073 Dealing with timestamp `>= (1 << 62)/1000` will be necessary when we read [year 146140482](https://3v4l.org/AAKNt). Commits ------- 7779ac1 [Intl] Remove incorrect condition in CurrencyDataGenerator::icuPairToDate
2 parents d5bb7c3 + 7779ac1 commit 1f64ca9

File tree

1 file changed

+0
-5
lines changed

1 file changed

+0
-5
lines changed

src/Symfony/Component/Intl/Data/Generator/CurrencyDataGenerator.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -236,11 +236,6 @@ private static function icuPairToDate(array $pair): string
236236
// Recompose a 64-bit unsigned integer from two 32-bit chunks.
237237
$unsigned64 = ((($highBits32 & 0xFFFFFFFF) << 32) | ($lowBits32 & 0xFFFFFFFF));
238238

239-
// Convert to signed 64-bit (two's complement) if sign bit is set.
240-
if ($unsigned64 >= (1 << 63)) {
241-
$unsigned64 -= (1 << 64);
242-
}
243-
244239
// Split into seconds and milliseconds.
245240
$seconds = intdiv($unsigned64, 1000);
246241
$millisecondsRemainder = $unsigned64 - $seconds * 1000;

0 commit comments

Comments
 (0)