/
Use platform independent crc32 version [5.2.1-RC1]
Use platform independent crc32 version [5.2.1-RC1]
The crc32
function behaves differently based on PHP (4.x, 5.x) or platform (32bit or 64bit). In particular in last PHP versions it always returns positive number (bigint), but used to return also negative numbers (int) before. This has created problems in past due hashes created on one server weren't matching ones, created on other server.
Here is how such problem was solved in past: abs(crc32(x))
. Such approach can result in duplicate CRC2 for values, that has N and -N CRC32 values. I recommend using kUtil::crc32
function, that does this: sprintf('%u', crc32(x))
.