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

Long forum post subject causes error

    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');

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            emerrill Eric Merrill added a comment -

            I can merge the fix if you would like, just wanted to run it by people who might care.

            -eric

            Show
            emerrill Eric Merrill added a comment - I can merge the fix if you would like, just wanted to run it by people who might care. -eric
            Hide
            dougiamas Martin Dougiamas added a comment -

            Thanks Eric, good idea!

            Show
            dougiamas Martin Dougiamas added a comment - Thanks Eric, good idea!
            Hide
            dougiamas Martin Dougiamas added a comment -

            +1 from me

            Show
            dougiamas Martin Dougiamas added a comment - +1 from me
            Hide
            emerrill Eric Merrill added a comment -

            Added to MOODLE_19_STABLE, MOODLE_18_STABLE and HEAD. Can somebody make sure I didn't mess up the tagging (first time ive done a multi trunk merge).

            Thanks
            -eric

            Show
            emerrill Eric Merrill added a comment - Added to MOODLE_19_STABLE, MOODLE_18_STABLE and HEAD. Can somebody make sure I didn't mess up the tagging (first time ive done a multi trunk merge). Thanks -eric
            Hide
            skodak Petr Skoda added a comment -

            reviewed, thanks

            Show
            skodak Petr Skoda added a comment - reviewed, thanks

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

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