Repository navigation
Conversation
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #194 +/- ##
=======================================
Coverage 68.65% 68.65%
=======================================
Files 7 7
Lines 1356 1356
Branches 248 248
=======================================
Hits 931 931
Misses 310 310
Partials 115 115 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
msgpack_unserialize_uint64()is meant to return a float for uint64 values aboveZEND_LONG_MAXthat a double still represents exactly (up to 2^52), and a decimal string beyond that (#67, fb746e0):On 32-bit,
longis 32 bits, so1L<<52is undefined behaviour. Every 32-bit build warns about it:In practice the float branch is never taken on 32-bit. Every uint64 above 2^31 comes back as a string. On i386 with PHP 8.5 and current master:
On 64-bit the branch can't be reached anyway, since 2^52 <
ZEND_LONG_MAX, so 32-bit is the only platform where the float range exists.The fix computes the bound as
(uint64_t) 1 << 52. The new testissue067_32bit_double.phpt(32-bit only) covers 2^31, 2^32 and 2^52 → float, and 2^52+1 → string. The existingissue067_32bit.phpt(values ≥ 2^63 → string) is unchanged.Behaviour change on 32-bit: values from 2^31 to 2^52 now unpack as
float, as the code intended, instead ofstring. Values above 2^52 are unchanged.Verification
Found while fixing 32-bit issues for Alpine (alpine/aports!111139, see also #192 and #193).
🤖 Generated with Claude Code