#38770 [Opn->Csd]: pack/unpack is broken on 64bit
| From: | iliaa@php.net | Date: | Sun, 19 Nov 2006 18:21:59 +0000 |
| Subject: | #38770 [Opn->Csd]: pack/unpack is broken on 64bit | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-105189@lists.php.net to get a copy of this message | ||
ID: 38770
Updated by: iliaa@php.net
Reported By: fwmatt at dsl dot pipex dot com
-Status: Open
+Status: Closed
Bug Type: Unknown/Other Function
Operating System: Linux x86_64
PHP Version: 5.1.6
New Comment:
This bug has been fixed in CVS.
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/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2006-09-10 16:31:27] fwmatt at dsl dot pipex dot com
Sorry for re-opening this but;
Why should the same code produce different output on a 64bit machine
than it does on a 32bit machine ?
If 4294937296 is the expect result then it is broken on 32bit machines
where it returns -30000.
------------------------------------------------------------------------
[2006-09-10 16:03:10] tony2001@php.net
http://php.net/pack:
N - unsigned long (always 32 bit, big endian byte order)
------------------------------------------------------------------------
[2006-09-10 15:55:20] fwmatt at dsl dot pipex dot com
Description:
------------
On my 32bit x86 system the attached code produces the expected results,
however on my x86 64bit system it produces the (actual) attached.
Reproduce code:
---------------
print_r( unpack( "N", pack( 'N', -30000 ) ));
Expected result:
----------------
Array
(
[1] => -30000
)
Actual result:
--------------
Array
(
[1] => 4294937296
)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=38770&edit=1