which parses $value as unsigned 32bit Big Endian Integer, although 32bit Integers in Cassandra are always signed. This breaks reading negative Integers from Cassandra.
Unfortunately PHP's unpack function seems to lack a mode for 32bit signed Big Endian. If your PHP-Code is running on a Little Endian plattform you can use
unpack('l', strrev($value));
to fix this. Another (endian safe) possible solution is to check if the returned value is >= 2^31 and substract 2^32 in this case.
Hello,
the unpackInteger() function uses
which parses $value as unsigned 32bit Big Endian Integer, although 32bit Integers in Cassandra are always signed. This breaks reading negative Integers from Cassandra. Unfortunately PHP's unpack function seems to lack a mode for 32bit signed Big Endian. If your PHP-Code is running on a Little Endian plattform you can use
to fix this. Another (endian safe) possible solution is to check if the returned value is >= 2^31 and substract 2^32 in this case.