[DDC-1978] SQLParserUtils array_fill tries to create array with zero elements when empty parameter is bound Created: 10/Aug/12  Updated: 18/Dec/13  Resolved: 29/Aug/12

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: 2.2.3
Fix Version/s: 2.4
Security Level: All

Type: Bug Priority: Minor
Reporter: Matt Button Assignee: Fabio B. Silva
Resolution: Fixed Votes: 0
Labels: None
Environment:

PHP 5.3.6-13ubuntu3.8 with Suhosin-Patch (cli) (built: Jun 13 2012 17:19:54)

{ "package": "doctrine/common", "version": "2.2.2" }

,

{ "package": "doctrine/dbal", "version": "2.2.x-dev", "source-reference": "b961a3fce6bf220f1dca47d7d747b9074bea4730", "commit-date": "1341779435" }

,

{ "package": "doctrine/doctrine-bundle", "version": "dev-master", "source-reference": "62134e6a8dd3f330131ee6a970f0cee1d7760c1d", "commit-date": "1343203511" }

,

{ "package": "doctrine/orm", "version": "2.2.x-dev", "source-reference": "5d2a3bcb3b467f41ee58575764f3ba84937f76e4", "commit-date": "1341676080" }

,



 Description   

When binding an empty array as a parameter (and specifying a parameter type to work around DDC-1977) SQLParserUtils::expandListParameters tries to use array_fill to generate an empty array.

https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/SQLParserUtils.php#L127

Pseudo-code that generated the bug:

$this->getEntityManager()->createNativeQuery($query, $rsm)->setParameter(1, array())->getArrayResult();


 Comments   
Comment by Benjamin Eberlei [ 15/Aug/12 ]

A related Github Pull-Request [GH-425] was opened
https://github.com/doctrine/doctrine2/pull/425

Comment by Benjamin Eberlei [ 15/Aug/12 ]

A related Github Pull-Request [GH-425] was closed
https://github.com/doctrine/doctrine2/pull/425

Comment by Fabio B. Silva [ 29/Aug/12 ]

Fixed by : https://github.com/doctrine/dbal/commit/24ec1947a83b82101845889ba4fc7f3cbd0e5a90

Comment by Doctrine Bot [ 18/Dec/13 ]

A related Github Pull-Request [GH-425] was closed:
https://github.com/doctrine/dbal/pull/425

Generated at Fri Apr 18 03:12:52 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.