ID: 39062
User updated by: ivoras at yahoo dot com
Reported By: ivoras at yahoo dot com
Status: Bogus
Bug Type: Variables related
Operating System: FreeBSD
PHP Version: 5.1.6
New Comment:
I guess there's no way PHP will be ready for serious work with this
kind of attitude. Type 'int' in C is signed 32-bit on all POSIX
systems, and there had to be special work done to break the behaviour
of a purely numeric integer function like crc32(). If you realise the
brokeness, please update documentation, add a bug description section,
wich at least documents it. The same suggestion is valid for all
functions that substantially differ from documented behaviour on
different architectures.
Previous Comments:
------------------------------------------------------------------------
[2006-10-06 13:36:03] [EMAIL PROTECTED]
Use dechex(crc32('10780')) to get string value, which is the same on
all architectures.
The integer value differs because of obvious reasons.
------------------------------------------------------------------------
[2006-10-06 13:09:43] ivoras at yahoo dot com
Description:
------------
crc32() in PHP returns an integer larger than 2G on a 64-bit platform;
It's documented, and applications rely on it, that it will return a
signed integer from the range [-2G .. 2G]. The major problem with
64-bit crc32() here is that databases can't store the value in a column
declared as INTEGER, thus braking compatibility.
Reproduce code:
---------------
echo crc32('10780');
Expected result:
----------------
-1171594808
Actual result:
--------------
3123372488
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=39062&edit=1