Doctrine DBAL
  1. Doctrine DBAL
  2. DBAL-496

"Undefined index" errors when using prepared statements

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.3.4
    • Component/s: None
    • Security Level: All
    • Labels:
      None

      Description

      Since a few days we are seeing errors like this in the Jackalope Doctrine DBAL test suite when using prepared statements:
      https://travis-ci.org/jackalope/jackalope-doctrine-dbal/jobs/6350278#L117

        Activity

        Hide
        Lars Strojny added a comment -

        Here is a successor for the fix from PR 301, @Fabio, could you test that with your code base: https://github.com/doctrine/dbal/pull/309

        Show
        Lars Strojny added a comment - Here is a successor for the fix from PR 301, @Fabio, could you test that with your code base: https://github.com/doctrine/dbal/pull/309
        Hide
        Fabio B. Silva added a comment -

        Benjamin, Not sure if we should consider this one related to #DBAL-488.
        It just show us another unsupported/unexpected behavior.

        Actually, it will keep failing with any parameter key starting with ':' when types are given.

        For instance :

        $query:

        SELECT * FROM foo WHERE bar = :bar

        $params:

        array(':bar'=>'Some String')

        $types:

        array(':bar'=>\PDO::PARAM_STR)
        Show
        Fabio B. Silva added a comment - Benjamin, Not sure if we should consider this one related to # DBAL-488 . It just show us another unsupported/unexpected behavior. Actually, it will keep failing with any parameter key starting with ':' when types are given. For instance : $query: SELECT * FROM foo WHERE bar = :bar $params: array(':bar'=>'Some String ') $types: array(':bar'=>\PDO::PARAM_STR)
        Hide
        Benjamin Eberlei added a comment -

        Reverted in master and 2.3

        Show
        Benjamin Eberlei added a comment - Reverted in master and 2.3
        Hide
        Fabio B. Silva added a comment - - edited

        I think the problem here is the ':' on the parameter key, which i'm not sure if are suported for DBAL.
        Before #DBAL-488 it does not apply 'SQLParserUtils::expandListParameters' for parameters without types.

        Show
        Fabio B. Silva added a comment - - edited I think the problem here is the ':' on the parameter key, which i'm not sure if are suported for DBAL. Before # DBAL-488 it does not apply 'SQLParserUtils::expandListParameters' for parameters without types.
        Show
        Daniel Leech added a comment - Seems this is caused by: https://github.com/doctrine/dbal/commit/64647f9e55749147b738cdba9378fa0401fadcbf
        Hide
        David Buchmann added a comment -

        are we doing something wrong or is this a regression in dbal?

        should we for now force an older version of doctrine-dbal? (this would be annyoing however, as we would run into version conflicts with doctrine-commons then i think)

        Show
        David Buchmann added a comment - are we doing something wrong or is this a regression in dbal? should we for now force an older version of doctrine-dbal? (this would be annyoing however, as we would run into version conflicts with doctrine-commons then i think)
        Hide
        Marco Pivetta added a comment -

        The notice is thrown in in

        Doctrine\DBAL\SQLParserUtils::expandListParameters

        Can be reproduced with parameters:

        $query:

        UPDATE phpcr_nodes SET sort_order = CASE CONCAT(
                  namespace,
                  (CASE namespace WHEN '' THEN '' ELSE ':' END),
                  local_name
                ) WHEN :name0 THEN :order0 WHEN :name1 THEN :order1 WHEN :name2 THEN :order2 WHEN :name3 THEN :order3 WHEN :name4 THEN :order4 ELSE sort_order END WHERE parent = :absPath
        

        $params:

        array(
            ':absPath' => '/topic',
            ':name0' => 'page3',
            ':order0' => 0,
            ':name1' => 'page1',
            ':order1' => 1,
            ':name2' => 'page2',
            ':order2' => 2,
            ':name3' => 'page3',
            ':order3' => 3,
            ':name4' => 'page4',
            ':order4' => 4,
        )
        

        $types:

        array()
        
        Show
        Marco Pivetta added a comment - The notice is thrown in in Doctrine\DBAL\SQLParserUtils::expandListParameters Can be reproduced with parameters: $query: UPDATE phpcr_nodes SET sort_order = CASE CONCAT( namespace, (CASE namespace WHEN '' THEN '' ELSE ':' END), local_name ) WHEN :name0 THEN :order0 WHEN :name1 THEN :order1 WHEN :name2 THEN :order2 WHEN :name3 THEN :order3 WHEN :name4 THEN :order4 ELSE sort_order END WHERE parent = :absPath $params: array( ':absPath' => '/topic', ':name0' => 'page3', ':order0' => 0, ':name1' => 'page1', ':order1' => 1, ':name2' => 'page2', ':order2' => 2, ':name3' => 'page3', ':order3' => 3, ':name4' => 'page4', ':order4' => 4, ) $types: array()
        Hide
        Marco Pivetta added a comment -

        First failure I can see is at https://travis-ci.org/jackalope/jackalope-doctrine-dbal/jobs/6347501 - is there any other relevant failure before that one?

        Show
        Marco Pivetta added a comment - First failure I can see is at https://travis-ci.org/jackalope/jackalope-doctrine-dbal/jobs/6347501 - is there any other relevant failure before that one?

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Lukas Kahwe
          • Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: