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

Issue Type: Bug Created: 2008-06-12T21:18:38.000+0000 Last Updated: 2013-03-13T20:55:25.000+0000 Status: Open Fix version(s): - Next Mini Release ()

Reporter: Diego Sainz (disago) Assignee: Ralph Schindler (ralph) Tags: - Zend_Db_Adapter_Mysqli

Related issues: Attachments: - ZF-3453.patch


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

<pre class="highlight">
            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:

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


Posted by Mark Evans (sparky) on 2008-12-20T05:19:18.000+0000

Added a patch to correctly identify the parameter types

Posted by Diego Sainz (disago) on 2009-03-19T19:46:39.000+0000

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?


Posted by Anthon Pang, VIP Software Technologies Inc. (vipsoft) on 2011-01-12T09:32:16.000+0000

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

Posted by Constantine Karnacevych (digital) on 2011-01-12T09:38:59.000+0000

the bug is for Mysqli, not Mysql

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.