Due to some unfortunate bugs on my project I recently discovered a terrific problem with mysqli and 64bit numbers: no matter you have a 64bit OS and php is compiled for x64, mysqli will truncate the to 32bit any 64bit number when calling the mysqli_stmt::bind_param() method. Due to this and the fact that I was using memcache to cache the objects, I didn’t noticed that the numbers were not properly saved until a memcached restart.
As replacing mysqli with another mysql driver can be a cumbersome operation on large projects, the simplest appoach to this problem is to have the db type as string and make sure the number goes as string and not as int to the db.
Recent Comments