#44317 [Opn->Bgs]: crc32() function breaks compatibility on 32-bit and 64-bit platforms

From: Date: Mon, 03 Mar 2008 14:12:26 +0000
Subject: #44317 [Opn->Bgs]: crc32() function breaks compatibility on 32-bit and 64-bit platforms
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-122876@lists.php.net to get a copy of this message
ID: 44317 Updated by: pajoye@php.net Reported By: vadim at vadiaz dot com -Status: Open +Status: Bogus Bug Type: Feature/Change Request Operating System: Linux PHP Version: 5.2.5 -Assigned To: +Assigned To: pajoye New Comment: As you noticed PHP has no unsigned integer. It can't return the same visual result without using strings. But we can't return string as it will break the backward compatibility and will add other bad side effects (related to bc too). See the manual notes if you like to get ride of this limitation. Previous Comments: ------------------------------------------------------------------------ [2008-03-03 09:42:38] vadim at vadiaz dot com Description: ------------ crc32() function result differs on 32-bit and 64-bit platforms which break compatibility. there is very ugly workaround like using dechex(crc32()) but this means that all the code must be reviewed before migrating to any platform which is not 32bit. Even there is no unsigned integer in PHP, this function must return the same numeric result. And sure this buggy behavior must be well documented. Reproduce code: --------------- php -r ' echo crc32("platform independant") . "\n";' Expected result: ---------------- -858128794 Actual result: -------------- 3436838502 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=44317&edit=1

« previous php.bugs (#122876) next »