Uploaded image for project: 'Doctrine DBAL'
  1. Doctrine DBAL
  2. DBAL-522

BC break : executeQuery with an array containing null value(s).

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.3.4
    • Fix Version/s: 2.4, 2.3.5
    • Component/s: None
    • Labels:
    • Environment:
      Mac OSX 10.8.3, Mysql 5.5.28, PHP5.4

      Description

      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)
           );
      

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

      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!

        Activity

        remy lemeunier created issue -
        ocramius Marco Pivetta made changes -
        Field Original Value New Value
        Description Hello, i have got an error with doctrine 2.3.4 when i try to run the following code :
        {quote}
            $conn->executeQuery(
                'INSERT INTO FOO (foo, bar) values (:foo, :bar)',
                 array('foo' => 1, 'bar' => null)
             );
        {quote}
        {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)
        {quote}
        line 215 : if (isset($paramsOrTypes[$paramName]))
        {quote}
        The key exists even if the value is null.
        So it should be:
        {quote}
          if (array_key_exists($paramName, $paramsOrTypes))
        {quote}


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

         


        Hello, i have got an error with doctrine 2.3.4 when i try to run the following code :
        {code}
            $conn->executeQuery(
                'INSERT INTO FOO (foo, bar) values (:foo, :bar)',
                 array('foo' => 1, 'bar' => null)
             );
        {code}
        {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)
        {code}
        line 215 : if (isset($paramsOrTypes[$paramName]))
        {code}
        The key exists even if the value is null.
        So it should be:
        {code}
          if (array_key_exists($paramName, $paramsOrTypes))
        {code}


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

         


        Hide
        ocramius Marco Pivetta added a comment -
        Show
        ocramius Marco Pivetta added a comment - I suggested a hotfix at https://github.com/doctrine/dbal/pull/322
        ocramius Marco Pivetta made changes -
        Fix Version/s 2.4 [ 10320 ]
        Fix Version/s 2.3.3 [ 10328 ]
        ocramius Marco Pivetta made changes -
        Assignee Benjamin Eberlei [ beberlei ] Marco Pivetta [ ocramius ]
        beberlei Benjamin Eberlei made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 2.3.5 [ 10520 ]
        Resolution Fixed [ 1 ]
        Hide
        remy lemeunier added a comment -

        Thanks for the hotfix.

        Show
        remy lemeunier added a comment - Thanks for the hotfix.
        guilhermeblanco Guilherme Blanco made changes -
        Fix Version/s 2.3.5 [ 10520 ]
        deeky666 Steve Müller made changes -
        Fix Version/s 2.3.5 [ 10721 ]

        This list may be incomplete, as errors occurred whilst retrieving source from linked applications:

        • Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={expand=changesets[0:20].revisions[0:29],reviews, query=DBAL-522}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

          People

          • Assignee:
            ocramius Marco Pivetta
            Reporter:
            remy lemeunier
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: