Am 16.09.2025 um 13:45 schrieb Alexandre Daubois <[email protected]>:
> I’d like to present this new RFC. When discussing the issue, we first thought
> that the RFC process wasn’t necessary. However, discussions on the PR showed
> that selecting new letters for pack and unpack is more challenging than we
> initially thought, thus creating an RFC for this change.
>
> Here is the link to the RFC:
> https://wiki.php.net/rfc/pack-unpack-endianness-signed-integers-support
Just a little side-note: unpackToSignedInt can be implemented more easily, e.g.
like
function unpackToSignedInt($bytes)
{
return ($uint32 = unpack('V', $bytes)[1]) < 2 ** 31 ? $uint32 :
$uint32 - 2 ** 32; # Use 'N' for big endian
}
While I undestand the wish for having all different sizes in all different
endian-ness I don't think it is that big of an issue for people dealing with
binary data, so I'm +-0 whether PHP really needs it.
Regards,
- Chris