Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 1.2.1, 1.2.2
-
Fix Version/s: None
-
Component/s: Query
-
Labels:None
-
Environment:PHP 5.2.11 Linux, Mysql 5.0.x
Description
Following the documentation, I'm using an IN condition in a where clause on a Doctrine_Query with Query cache enabled (APC). Syntax:
$values = array(1, 2, 3, 4);
$q = Doctrine_Query::create()
>from('SomeModel s')>where('s.column IN ?', array($values));$results = $q->execute();
The first time this query is run, all is fine, and any subsequent runs will be fine as well, UNLESS the values array changes length, like so:
$values = array(1, 2, 3, 4, 5);
$q = Doctrine_Query::create()
>from('SomeModel s')>where('s.column IN ?', array($values));$results = $q->execute();
With the query cache enabled, this will throw a PDO "Invalid Parameter Count" exception, because it appears that Doctrine uses the cached query which only has 4 placeholders, but the passed parameters now has a count of 5.
A change in the length of the parameters array in this situation should cause Doctrine to insert a new entry into the query cache for this query.
Let me know if you need more information regarding this, if I find time I can try to put together a Test case.
Thanks!
Failing test case exhibiting this bug.