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

Inherit template causes SQL error

    Details

    • Type: Bug
    • Status: Unverified Fix
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.1.0-dev
    • Fix Version/s: 3.1.0-a1
    • Component/s: Styles
    • Labels:
      None
    • Environment:
      PHP 5.3.0, MySQL 5.1.37, phpmyadmin 3.2.1, Firefox 8, Windows XP

      Description

      When inheriting template is enabled in template.cfg, when installing the style causes the following error:

      General Error
      SQL ERROR [ mysqli ]
       
      You have an error in your SQL syntax near ' bbcode_bitfield FROM phpbb_styles_template WHERE template_name = 'pro' at line 1 [1064]
       
      SQL
       
      SELECT template_id, template_name, template_path, , bbcode_bitfield FROM phpbb_styles_template WHERE template_name = 'prosilver' AND template_inherits_id = 0
       
      BACKTRACE
       
      FILE: [ROOT]/includes/db/mysqli.php
      LINE: 182
      CALL: dbal->sql_error()
       
      FILE: [ROOT]/includes/acp/acp_styles.php
      LINE: 2407
      CALL: dbal_mysqli->sql_query()
       
      FILE: [ROOT]/includes/acp/acp_styles.php
      LINE: 2288
      CALL: acp_styles->install_element()
       
      FILE: [ROOT]/includes/acp/acp_styles.php
      LINE: 1989
      CALL: acp_styles->install_style()
       
      FILE: [ROOT]/includes/acp/acp_styles.php
      LINE: 113
      CALL: acp_styles->install()
       
      FILE: [ROOT]/includes/functions_module.php
      LINE: 508
      CALL: acp_styles->main()
       
      FILE: [ROOT]/adm/index.php
      LINE: 73
      CALL: p_master->load_active()

        Issue Links

          Activity

          Hide
          imkingdavid David King added a comment - - edited

          Offending code:

          if ($mode === 'template')
          			{
          				$select_bf = ', bbcode_bitfield';
          			}
          			else
          			{
          				$select_bf = '';
          			}
           
          			$sql = "SELECT {$mode}_id, {$mode}_name, {$mode}_path, $select_bf
          				FROM $sql_from
          				WHERE {$mode}_name = '" . $db->sql_escape($cfg_data['inherit_from']) . "'
          					AND {$mode}_inherits_id = 0";

          Untested Fix:

          if ($mode === 'template')
          			{
          				$select_bf = ', bbcode_bitfield';
          			}
          			else
          			{
          				$select_bf = '';
          			}
           
          			$sql = "SELECT {$mode}_id, {$mode}_name, {$mode}_path{$select_bf}
          				FROM $sql_from
          				WHERE {$mode}_name = '" . $db->sql_escape($cfg_data['inherit_from']) . "'
          					AND {$mode}_inherits_id = 0";

          Show
          imkingdavid David King added a comment - - edited Offending code: if ($mode === 'template') { $select_bf = ', bbcode_bitfield'; } else { $select_bf = ''; }   $sql = "SELECT {$mode}_id, {$mode}_name, {$mode}_path, $select_bf FROM $sql_from WHERE {$mode}_name = '" . $db->sql_escape($cfg_data['inherit_from']) . "' AND {$mode}_inherits_id = 0"; Untested Fix: if ($mode === 'template') { $select_bf = ', bbcode_bitfield'; } else { $select_bf = ''; }   $sql = "SELECT {$mode}_id, {$mode}_name, {$mode}_path{$select_bf} FROM $sql_from WHERE {$mode}_name = '" . $db->sql_escape($cfg_data['inherit_from']) . "' AND {$mode}_inherits_id = 0";
          Hide
          Oleg Oleg [X] (Inactive) added a comment -
          Show
          Oleg Oleg [X] (Inactive) added a comment - https://github.com/phpbb/phpbb3/commit/c2d6c613 left a trailing comma.

            People

            • Assignee:
              bantu Andreas Fischer
              Reporter:
              _Vinny_ Marcus Vinicius
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development