Bug #61764 [Asn->Csd]: output of unpack while 'I' used
| From: | cataphract@php.net | Date: | Tue, 24 Apr 2012 09:29:53 +0000 |
| Subject: | Bug #61764 [Asn->Csd]: output of unpack while 'I' used | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-169911@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=61764&edit=1
ID: 61764
Updated by: cataphract@php.net
Reported by: pgajdos at suse dot com
Summary: output of unpack while 'I' used
-Status: Assigned
+Status: Closed
Type: Bug
Package: Unknown/Other Function
Operating System: Linux
PHP Version: 5.3.10
Assigned To: cataphract
Block user comment: N
Private report: N
New Comment:
This bug has been fixed in SVN.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
For Windows:
http://windows.php.net/snapshots/
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2012-04-23 21:11:04] cataphract@php.net
Automatic comment on behalf of cataphract
Revision: http://git.php.net/?p=php-src.git;a=commit;h=8d748e5de519867d9b6ce40e3ea28a209b07768f
Log: Fixed bug #61764: 'I' unpacks n as signed if n > 2^31-1 on LP64
------------------------------------------------------------------------
[2012-04-20 07:47:00] cataphract@php.net
Verified. If PHP can represent the unpacked unsigned number with its integer type, it should never
return a negative number.
The result of pack() is correct:
http://www.wolframalpha.com/input/?i=%28-30000+mod+2%5E32%29+in+hex
ffff8ad0_16
$ php -r "print_r(unpack('H*', pack('I', -30000)));"
Array
(
[1] => d08affff
)
------------------------------------------------------------------------
[2012-04-18 13:32:15] pgajdos at suse dot com
Description:
------------
php -r "print_r(unpack('I', pack('I', -30000)));
gives 4294937296 on s390x but -30000 on x86_64. According to manual I think correct value should be
4294937296 on x86_64. Also perl returns this number for
perl -e "print unpack('I', pack('I', -30000))" for these two
architectures.
Or have I misunderstood something?
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=61764&edit=1