ZF-3453: Zend_Db_Statement_Mysqli::_execute() binds every parameter as type "s", causing bit type mysql columns (and others?) to fail with "Data too long" error


When Zend_Db_Statement_Mysqli::_execute() prepares parameters types to bind before executing it does the next :

            array_unshift($params, str_repeat('s', count($params)));

And when a bit type column value is passed to the statement (for example by Zend_Db_Table_Abstract:insert(), the query will fail with "Data too long for column X".

Proposed solution:

There should be some basic parameter type checking, something like:

            for($n=0;$n<$numParams;$n++) {
                if (is_numeric($params[$n])) {
                    if (is_double($params[$n])) {
                    else {
                else {
            array_unshift($params, $types);


Added a patch to correctly identify the parameter types

As of ZF 1.7.7 this issue remains unsolved (and the patch is already attached).

The 'nice to have' status sounds inadequate to me because this bug disables the use of Zend_Db_Statement in mysql if bit columns are being used.

Any comments?


This is still outstanding in 1.11.2, and is inconsistent because it doesn't occur when using Zend_Db_Adapter_Pdo_Mysql.

the bug is for Mysqli, not Mysql