Doctrine DBAL
  1. Doctrine DBAL
  2. DBAL-508

MySqlSchemaManager accessing undefined index tableColumn[comment]

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Affects Version/s: 2.3.3
    • Fix Version/s: 2.4
    • Component/s: Schema Managers
    • Labels:
      None
    • Environment:
      Linux 3.2.0-24-generic-pae #39-Ubuntu,
      mysql Ver 14.14 Distrib 5.5.31, for debian-linux-gnu (i686) using readline 6.2

      Description

      in the method Doctrine\DBAL\Schema\MySqlSchemaManager::_getPortableTableColumnDefinition the index "comment" in the array $tableColumn is accessed without ensuring that this index is set. This leads to an Undefined index: comment warning in E_ALL-environments.

      This method is triggered e.g. by the Doctrine\ORM\Tools\SchemaTool getUpdateSchemaSql method.

        Activity

        Hide
        Benjamin Eberlei added a comment -

        Special case fixed for 2.4

        Show
        Benjamin Eberlei added a comment - Special case fixed for 2.4
        Hide
        Martin Kuckert added a comment -

        I've just found the issue. The main problem is the usage of 'DESCRIBE ' . $table; in the getListTableColumnsSQL, if there's no $database set. describe does not return the comment column, but 'show full columns from ' . $table; does.
        At the basis of the missing $database value was my own DBAL\Driver implementation not properly returning the currently connected database. So $database was NULL and the alternate code path was executed, so resulting in no comment-property.

        Seems like an uncovered code path instead of a bug in a real environment.

        Show
        Martin Kuckert added a comment - I've just found the issue. The main problem is the usage of 'DESCRIBE ' . $table; in the getListTableColumnsSQL, if there's no $database set. describe does not return the comment column, but 'show full columns from ' . $table; does. At the basis of the missing $database value was my own DBAL\Driver implementation not properly returning the currently connected database. So $database was NULL and the alternate code path was executed, so resulting in no comment-property. Seems like an uncovered code path instead of a bug in a real environment.
        Hide
        Benjamin Eberlei added a comment -

        Can't really explain this, the key has to be existant. This is only called with information from MysqlPlatform#getListTableColumnsSQL().

        Show
        Benjamin Eberlei added a comment - Can't really explain this, the key has to be existant. This is only called with information from MysqlPlatform#getListTableColumnsSQL().

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Martin Kuckert
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: