Backporting from 2.4 fix for booleans in mysql when running PHP 5.5