ZF-2018: getQueryParams() returns wrong array


Consider the following snippet:

$params = array ( 
    'host'     => 'localhost',
    'username' => 'user',
    'password' => 'pass',
    'dbname'   => 'test',
    'profiler' => true
$db = Zend_Db::factory('PDO_MYSQL', $params);

$query = "SELECT * FROM table WHERE field1 = ? AND field2 = ?";

$stmt = $db->query(

$profiler = $db->getProfiler();
$profile = $profiler->getLastQueryProfile();

The output of the var_dump will be: array(2) { [1]=> string(4) "value2" [2]=> string(4) "value2" }

Whereas the first value should be value1, not value2. I've tested it with bigger arrays too and in every testcase the whole array is filled with the value of the last item.

Even though getQueryParams returns the wrong values, he values are correctly inserted into the prepared-statement.

Although it's only a minor loss of functionality, I put Major as the priority because there is no easy workaround. At least, i don't know any way to find out which values have been given to the prepared statement without this function.


Assigned to Bill

This issue should have been fixed for the 1.5 release.

Please categorize/fix as needed.

This doesn't appear to have been fixed in 1.5.0. Please update if this is not correct.

Cannot reproduce with the same piece of code. Probably corrected by SVN6163 and SVN6170 even if it were not the initial goal.