fridge-project/dbal — pull request #46 by egeloen (2012-12-14 16:10:12+00:00)
Title: [QueryRewriter] If Positional params and types are not properly ordered, the query will not be rewritten correctly

When rewriting a query using positional parameters, if the array of params and type is ordered for example like this (eg. not properly) :

```php
'?',
0 => '?',
2 => '?'
);

$types = array(
1 => 'integer[]',
0 => 'string',
2 => 'string'
);
```

The QueryRewriter will fail as it tries to rewrite from the beginning of the query string and parse the params by order. At each step, the algorithm calculates the position of the next params after rewrite, so this part will fail.

The easiest solution would be to sort the array before rewrite.