Edit report at https://bugs.php.net/bug.php?id=61764&edit=1

 ID:                 61764
 Updated by:         cataphr...@php.net
 Reported by:        pgajdos at suse dot com
 Summary:            output of unpack while 'I' used
-Status:             Open
+Status:             Assigned
 Type:               Bug
 Package:            Unknown/Other Function
 Operating System:   Linux
 PHP Version:        5.3.10
-Assigned To:        
+Assigned To:        cataphract
 Block user comment: N
 Private report:     N

 New Comment:

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
)


Previous Comments:
------------------------------------------------------------------------
[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

Reply via email to