Skip to content

Loading…

DBAL-522: BC break : executeQuery with an array containing null value(s). #1728

Closed
doctrinebot opened this Issue · 3 comments

2 participants

@doctrinebot

Jira issue originally created by user remy:

Hello, i have got an error with doctrine 2.3.4 when i try to run the following code :

    $conn->executeQuery(
        'INSERT INTO FOO (foo, bar) values (:foo, :bar)', 
         array('foo' => 1, 'bar' => null)
     );

{quote}
Error : Value for :bar not found in params array. Params array key should be "bar"
{quote}

This code worked with doctrine 2.3.3.

I think the error comes from the function 'extractParam' in SQLParserUtils.php (DBAL)

line 215 : if (isset($paramsOrTypes[$paramName]))

The key exists even if the value is null.
So it should be:

  if (array*key*exists($paramName, $paramsOrTypes)) 

I am not enough confident to try a PR.
Thanks in advance!

@doctrinebot

Comment created by @ocramius:

I suggested a hotfix at #322

@doctrinebot

Issue was closed with resolution "Fixed"

@doctrinebot

Comment created by remy:

Thanks for the hotfix.

@doctrinebot doctrinebot added the Bug label
@Ocramius Ocramius was assigned by doctrinebot
@doctrinebot doctrinebot added this to the 2.3.5 milestone
@doctrinebot doctrinebot closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.