Uploaded image for project: 'phpBB3'
  1. phpBB3
  2. PHPBB3-9892

Firebird index name length limit is not taken into account

    Details

    • Type: Bug
    • Status: Unverified Fix
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.0.8-RC1
    • Fix Version/s: 3.0.9-RC1
    • Labels:
      None
    • Environment:
      PHP 5.3.2, Firebird 2.1,

      Description

      Firebird 2.1 has a maximum length of an index name equal to 31 characters.

      For example when creating the index for the QaA CAPTCHA plug-in this error occurs:

      General Error
      SQL ERROR [ firebird ]
       
      unsuccessful metadata update Name longer than database column size [-607]
       
      SQL
       
      CREATE INDEX phpbb_captcha_questions_lang_iso ON phpbb_captcha_questions(lang_iso)
       
      BACKTRACE
      

      The reason is that phpbb_captcha_questions_lang_iso is 32 characters long.

        Issue Links

          Activity

          Hide
          naderman Nils Adermann added a comment -

          So far I have fixed some problems with Firebird and db_tools as well as added several db_tools tests. I've fixed the length limit as well as added a check that should prevent this from happening again even if a db_tools call isn't tested on firebird. Still missing code to recover from possibly inconsistent state after creating the table with a broken version.

          https://github.com/naderman/phpbb3/tree/ticket/9892

          Show
          naderman Nils Adermann added a comment - So far I have fixed some problems with Firebird and db_tools as well as added several db_tools tests. I've fixed the length limit as well as added a check that should prevent this from happening again even if a db_tools call isn't tested on firebird. Still missing code to recover from possibly inconsistent state after creating the table with a broken version. https://github.com/naderman/phpbb3/tree/ticket/9892
          Hide
          naderman Nils Adermann added a comment -

          Update code finished. Tested updating on firebird. Works fine, logging in works fine. Q&A works too now.

          Show
          naderman Nils Adermann added a comment - Update code finished. Tested updating on firebird. Works fine, logging in works fine. Q&A works too now.
          Hide
          naderman Nils Adermann added a comment -

          There is a minor problem with the transaction support for _sql in database_update.php causing a NOTICE.

          Show
          naderman Nils Adermann added a comment - There is a minor problem with the transaction support for _sql in database_update.php causing a NOTICE.
          Hide
          Sajaki Sajaki added a comment - - edited

          this change introduces a new bug when installing mods in a phpbb board under mysql having indexes longer than 24 characters.

          [code]Index name 'phpbb_socialnet_im_chatboxes_idx_chatbox' on table 'phpbb_socialnet_im_chatboxes' is too long. The maximum is 24 characters.[/code]
          [code]Index name 'phpbb_bbdkp_adjustments_member_id' on table 'phpbb_bbdkp_adjustments' is too long. The maximum is 24 characters.[/code]

          99% of phpBB installations use Mysql, so why risk breaking them for the 1% using firebird ?

          Show
          Sajaki Sajaki added a comment - - edited this change introduces a new bug when installing mods in a phpbb board under mysql having indexes longer than 24 characters. [code] Index name 'phpbb_socialnet_im_chatboxes_idx_chatbox' on table 'phpbb_socialnet_im_chatboxes' is too long. The maximum is 24 characters. [/code] [code] Index name 'phpbb_bbdkp_adjustments_member_id' on table 'phpbb_bbdkp_adjustments' is too long. The maximum is 24 characters. [/code] 99% of phpBB installations use Mysql, so why risk breaking them for the 1% using firebird ?
          Hide
          Sajaki Sajaki added a comment - - edited

          the quick fix for this would be :
          open /includes/db/db_tools.php

          find (twice) and change 24 to something bigger :

          $table_prefix = substr(CONFIG_TABLE, 0, -6); // strlen(config)
                    if (strlen($table_name . $index_name) - strlen($table_prefix) > 24)
                    {
                       $max_length = $table_prefix + 24;

          (todo : add switch for db type so this does not apply for firebird)

          Show
          Sajaki Sajaki added a comment - - edited the quick fix for this would be : open /includes/db/db_tools.php find (twice) and change 24 to something bigger : $table_prefix = substr(CONFIG_TABLE, 0, -6); // strlen(config) if (strlen($table_name . $index_name) - strlen($table_prefix) > 24) { $max_length = $table_prefix + 24; (todo : add switch for db type so this does not apply for firebird)

            People

            • Assignee:
              naderman Nils Adermann
              Reporter:
              ameeck Vojtech Vondra
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development