|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-06-02 10:57 UTC] ads at tristanleboss dot net
-Package: *Mail Related
+Package: *Math Functions
[2016-06-02 10:57 UTC] ads at tristanleboss dot net
[2016-06-02 11:20 UTC] requinix@php.net
-Status: Open
+Status: Not a bug
[2016-06-02 11:20 UTC] requinix@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 07:00:01 2025 UTC |
Description: ------------ Hello, While doing some tests, I discovered the 'P' format (unsigned long long (always 64 bit, little endian byte order)) and the 'J' format (unsigned long long (always 64 bit, big endian byte order)) are not giving the expected results on my Windows 7 x64 test machine with PHP 7.0.7RC1. Indeed, they don't account for the "unsigned" nature and output the signed version. Indeed: unpack('P', "\xC0\x00\xF8\x90\x32\x04\x00\x90") will output "-8070445917020880704". The expected result is "13835331353480265872". unpack('J', "\xC0\x00\xF8\x90\x32\x04\x00\x90") will output "-4611412720229285744". The expected result is "10376298156688670912". No error/warning message will be displayed. Test script: --------------- <?php var_dump( unpack('P', "\xC0\x00\xF8\x90\x32\x04\x00\x90") ); var_dump( unpack('J', "\xC0\x00\xF8\x90\x32\x04\x00\x90") ); Expected result: ---------------- array(1) { [1]=> int(13835331353480265872) } array(1) { [1]=> int(10376298156688670912) } Actual result: -------------- array(1) { [1]=> int(-8070445917020880704) } array(1) { [1]=> int(-4611412720229285744) }