Details
Description
Today I ran into the following Zend_DB exception when running some routine select queries on a MySQL database:
SQLSTATE[HY093]: Invalid parameter number: no parameters were bound
It seems the culprit was a three-character :0' sequence in a string in the WHERE clause. That's a column, zero, and apostrophe. If you have other characters between the zero and apostrophe, it will still generate the exception, but the column and zero need to be together. You should be able to reproduce this bug if you pass one of the two following to a fetchCol or fetchAll query.
$sql = 'SELECT something FROM somewhere WHERE somethingElse = ' . $db->quote(":0'");
or simply:
$sql = 'SELECT something FROM somewhere WHERE somethingElse = ':0\'';
As this is valid sql syntax, it seems something goes awry in how Zend_DB parses the string internally.
Assigned to Bill