Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-10363

Custom BBCodes hardcoded ID limit of 1511

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Minor Minor
    • 3.2.2-RC1
    • 3.0.9
    • ACP, BBCode Engine
    • None
    • PHP 5.2.6, MySQL 5.0.67, OPER 11.50

      In /includes/acp/acp_bbcodes.php upon trying to add a new custom BBCode you encounter this block of code:

      if ($bbcode_id > 1511)
      {
      	trigger_error($user->lang['TOO_MANY_BBCODES'] . adm_back_link($this->u_action), E_USER_WARNING);
      }

      There are several issues with this:

      1. Why 1511 if the column datatype is (for MySQL) TINYINT(3) and thus could never go beyond 999?
      2. Why not having a datatype (for MySQL) of i.e. MEDIUMINT(8)? Because:
      3. Consider the user (or the installation of a MOD or several DB restorations) having inserted a couple of custom BBCodes and then delete them again: those IDs are lost and won't be re-used ever. Thus, once the user hits this 1511 limit he can't do anything about it anymore.
      4. This problem has risen in this phpBB Support topic and I think it can be solved only by changing the PHP file and augmenting the database table column datatype.

      Since that did not really solve the problem (it's only a workaround and in a distant future the same problem will be encountered again), the PHP code needs to be modified. I think the best idea would be to:

      1. SELECT all BBCode IDs, so you have a list of existing ones
      2. Count from NUM_CORE_BBCODES+ 1 upwards until you have an ID which is not in that list
      3. Serve this ID when INSERTing the dataset.

      That way native BBCodes aren't touched and the ID of existing custom BBCodes is not needed anymore for examining a questionable MAX() approach

            CHItA CHItA
            AmigoJack AmigoJack
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: