May 25, 2012

Post: Integers in PHP, running with scissors, and portability

…, PHP just brought me a new definition of “portable” – and that was when working with… integers. PHP is not able to handle unsigned integers, and…, and PHP decides to treat them as integers, you’re in trouble. Oh wait, no – that’s on 32-bit platforms only! PHP int… short, it’s 2007 now but there’s no native 64-bit integer type in PHP. Let me remind that built-in “int…

Comment: PHP vs. BIGINT vs. float conversion caveat

php.net/float by the way). Doubles have 52 bits allocated for mantissa, which means that 52-bit (actually 53-bit) INTEGER values MUST be stored without ANY precision loss. > PHP tries to handle this in a…/extension? No, it isn’t (other environments somehow manage to nicely support 64-bit values), but that’s out of scope. One…

Post: MySQL automatic data truncation can backfire

PHP and MySQL are both to blame. PHP is to blame because in 32bit PHP version result of crc32() function was returned as signed integer, in 64bit build of same PHP version… cardinality for this constant is low) and discarding all of them before no values matched supplied key value. So beware, data truncation…