Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-15697

Long forum post subject causes error

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9, 1.9.1, 1.9.2
    • Fix Version/s: 1.8.7, 1.9.3
    • Component/s: Forum
    • Labels:
      None
    • Environment:
      Moodle 1.9.2, Postgres, PHP 4.x
    • Database:
      Any
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_18_STABLE, MOODLE_19_STABLE

      Description

      The DB field for forum_posts->subject is varchar(255), but the web form does not enforce this. If a longer subject is entered, a 'Could not add your post due to an unknown error' is thrown when on Postgres, under MySQL the subject just gets truncated by the DB, with no knowledge of the user.

      Solution is to add this at line 118 of mod/forum/post_form.php:
      $mform->addRule('subject', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');

      Same problem found with the forum name. Should add this at like 17 of mod/forum/mod_forum.php:
      $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');

        Attachments

          Activity

            People

            Assignee:
            emerrill Eric Merrill
            Reporter:
            emerrill Eric Merrill
            Tester:
            Petr Skoda
            Participants:
            Component watchers:
            Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              15/Oct/08