#39062 [NEW]: crc32() returns 64-bit number on 64-bit achitectures

From: Date: Fri, 06 Oct 2006 13:09:43 +0000
Subject: #39062 [NEW]: crc32() returns 64-bit number on 64-bit achitectures
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-103192@lists.php.net to get a copy of this message
From:             ivoras at yahoo dot com
Operating system: FreeBSD
PHP version:      5.1.6
PHP Bug Type:     Variables related
Bug description:  crc32() returns 64-bit number on 64-bit achitectures

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 bug report at http://bugs.php.net/?id=39062&edit=1
-- 
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=39062&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=39062&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=39062&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=39062&r=fixedcvs
Fixed in release:             http://bugs.php.net/fix.php?id=39062&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=39062&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=39062&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=39062&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=39062&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=39062&r=notwrong
Not enough info:              http://bugs.php.net/fix.php?id=39062&r=notenoughinfo
Submitted twice:              http://bugs.php.net/fix.php?id=39062&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=39062&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=39062&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=39062&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=39062&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=39062&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=39062&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=39062&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=39062&r=mysqlcfg


Thread (3 messages)

« previous php.bugs (#103192) next »