Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 2.1.1
-
Fix Version/s: 2.1.5
-
Component/s: None
-
Security Level: All
-
Labels:None
Description
Named parameters appears to be treated as ordered parameters, when using PARAM_INT_ARRAY or PARAM_STR_ARRAY:
$query = $em->createQuery('
SELECT f FROM Foo f
WHERE a = :a
AND b IN (:b)
');
$query->setParameters(array(
'b' => array(1,2,3),
'a' => 1,
));
Notice that in the query the parameter :a appears before :b. And I call ->setParameters() with :b before :a.
When running this, I get an error from Doctrine/DBAL/SQLParserUtils::expandListParameters:119 saying that the second parameter of array_merge() is not an array.
When setting the parameters in the same order than they appear in the query, it works:
$query->setParameters(array(
'a' => 1,
'b' => array(1,2,3),
));
This is unexpected, as I'm using named parameters; the order should not matter.
Fixed