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

Data too long for column 'message_subject'

    Details

    • Type: Bug
    • Status: Unverified Fix
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.0.2
    • Fix Version/s: 3.0.8-RC1
    • Component/s: Posting
    • Labels:
      None

      Description

      It reminds me of: http://www.phpbb.com/bugs/phpbb3/25235
      the problem is, mnessage subject is not shortend by truncate_string() as post_subject and topic_title are.

      Fix should be something like:
      includes/functions_privmsg.php

      	// Recipient Information
      	$recipients = $to = $bcc = array();

      after add:

      	// First of all make sure the subject are having the correct length.
      	// To achieve this without cutting off between special chars we convert to an array and then count the elements.
      	$subject = truncate_string($subject);

      The same problem occures while saving drafts of PMs and Posts.

      Also the problem wasn't fixed completely, as it still occures, while replying to a topic.
      this is caused by

      	if ($strip_reply)
      	{
      		$string = 'Re: ' . $string;
      	}

      which is added to the 255 chars after checking for the length.
      the fix for this behaviour is:
      includes/functions_content.php

      while (utf8_strlen($string) > $max_store_length || !sizeof($chars));

      replace with:

      while (utf8_strlen($string) > (($strip_reply) ? ($max_store_length - 4) : $max_store_length) || !sizeof($chars));

      the same problem may occure with $append, just didn't find a place where it is used

      While i was asking some points about this in the #phpbb-qa fawek confirmed this bug in the ACP and UCP

        Activity

        Hide
        faw faw added a comment -

        Here is the solution for set_config().

        Index: includes/functions.php
        ===================================================================
        --- includes/functions.php	(version 8839)
        +++ includes/functions.php	(working copy)
        @@ -142,6 +142,8 @@
         {
         	global $db, $cache, $config;
         
        +	$config_value = truncate_string($config_value, 255);
        +
         	$sql = 'UPDATE ' . CONFIG_TABLE . "
         		SET config_value = '" . $db->sql_escape($config_value) . "'
         		WHERE config_name = '" . $db->sql_escape($config_name) . "'";

        Well, I know that it's bad solution, since truncate_string() should be used for topic titles, post subjects etc., but not for configs. I just can't find any other sensible way to fix this at the moment.

        The decision is yours, but I think it's some kind of design failure. So there is an option to fix all these cases or think about new concept to cope with this stuff. Even in 3.0 line.

        As nickvergessen mentioned above, the problem occures also in UCP (user profile forms) and can occure in many other cases. I am sure also that many MODs have got this bug too.

        Show
        faw faw added a comment - Here is the solution for set_config(). Index: includes/functions.php =================================================================== --- includes/functions.php (version 8839) +++ includes/functions.php (working copy) @@ -142,6 +142,8 @@ { global $db, $cache, $config; + $config_value = truncate_string($config_value, 255); + $sql = 'UPDATE ' . CONFIG_TABLE . " SET config_value = '" . $db->sql_escape($config_value) . "' WHERE config_name = '" . $db->sql_escape($config_name) . "'"; Well, I know that it's bad solution, since truncate_string() should be used for topic titles, post subjects etc., but not for configs. I just can't find any other sensible way to fix this at the moment. The decision is yours, but I think it's some kind of design failure. So there is an option to fix all these cases or think about new concept to cope with this stuff. Even in 3.0 line. As nickvergessen mentioned above, the problem occures also in UCP (user profile forms) and can occure in many other cases. I am sure also that many MODs have got this bug too.
        Hide
        nickvergessen Joas Schilling added a comment -

        Same problem occures on forum_links:
        http://www.phpbb.de/viewtopic.php?p=1028155#1028155

        on check the thing for the links i noticed it should be the same on the forum-name
        but may its better to display an other message to the user, than simply cutting down his links

        Show
        nickvergessen Joas Schilling added a comment - Same problem occures on forum_links: http://www.phpbb.de/viewtopic.php?p=1028155#1028155 on check the thing for the links i noticed it should be the same on the forum-name but may its better to display an other message to the user, than simply cutting down his links

          People

          • Assignee:
            nickvergessen Joas Schilling
            Reporter:
            nickvergessen Joas Schilling
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development