Unverified Commit 0f174825 authored by Sergei Morozov's avatar Sergei Morozov Committed by GitHub

Merge pull request #3894 from morozov/issues/2897

Make sure that the $types array has the same keys $params
parents 9e880d97 21512f9e
...@@ -4,7 +4,9 @@ namespace Doctrine\DBAL; ...@@ -4,7 +4,9 @@ namespace Doctrine\DBAL;
use const PREG_OFFSET_CAPTURE; use const PREG_OFFSET_CAPTURE;
use function array_fill; use function array_fill;
use function array_fill_keys;
use function array_key_exists; use function array_key_exists;
use function array_keys;
use function array_merge; use function array_merge;
use function array_slice; use function array_slice;
use function array_values; use function array_values;
...@@ -131,6 +133,10 @@ class SQLParserUtils ...@@ -131,6 +133,10 @@ class SQLParserUtils
$bindIndex = -1; $bindIndex = -1;
if ($isPositional) { if ($isPositional) {
// make sure that $types has the same keys as $params
// to allow omitting parameters with unspecified types
$types += array_fill_keys(array_keys($params), null);
ksort($params); ksort($params);
ksort($types); ksort($types);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment