[DBAL-171] PARAM_INT_ARRAY / PARAM_STR_ARRAY depends of parameter order Created: 11/Sep/11 Updated: 18/Nov/11 Resolved: 18/Nov/11
Named parameters appears to be treated as ordered parameters, when using PARAM_INT_ARRAY or PARAM_STR_ARRAY:
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:
This is unexpected, as I'm using named parameters; the order should not matter.
|Comment by Patrick Schwisow [ 27/Sep/11 ]|
I'm getting this issue too.
Doctrine\ORM\Query::_doExecute() does a ksort on $sqlParams, but does not sort $types. Doctrine\DBAL\SQLParserUtils::expandListParameters() assumes that $params and $types are in the same order.
As a workaround, I added ksort($types) in _doExecute(), but I'm not sure if this is the proper way to handle this.
|Comment by Benjamin Eberlei [ 18/Nov/11 ]|