#39062 [Opn->Bgs]: crc32() returns 64-bit number on 64-bit achitectures

From: Date: Fri, 06 Oct 2006 13:36:04 +0000
Subject: #39062 [Opn->Bgs]: crc32() returns 64-bit number on 64-bit achitectures
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-103194@lists.php.net to get a copy of this message
ID: 39062 Updated by: tony2001@php.net Reported By: ivoras at yahoo dot com -Status: Open +Status: Bogus Bug Type: Variables related Operating System: FreeBSD PHP Version: 5.1.6 New Comment: Use dechex(crc32('10780')) to get string value, which is the same on all architectures. The integer value differs because of obvious reasons. Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#103194) next »