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

DB error when using in-page discussion creation to create a discussion with subject, and no message

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 3.7
    • Fix Version/s: 3.7
    • Component/s: Forum
    • Labels:
    • Testing Instructions:
      Hide
      1. Log in as Admin.
      2. Create a Course.
      3. Create a Forum activity in the forum.
      4. Attempt to create a discussion from the inline discussion creation form.
        1. Enter a subject
        2. Leave the message empty
        3. Click "Post to forum"
          1. make sure you do not see any DB errors
          2. make sure you see a form warning that the Message is a required field. (NOTE: you will be redirected to the advanced discussion form)
      5. Attempt to create a discussion from the advanced discussion creation form.
        1. Enter a subject
        2. Leave the message empty
        3. Click "Post to forum"
          1. make sure you do not see any DB errors
          2. make sure you see a form warning that the Message is a required field
      Show
      Log in as Admin. Create a Course. Create a Forum activity in the forum. Attempt to create a discussion from the inline discussion creation form. Enter a subject Leave the message empty Click "Post to forum" make sure you do not see any DB errors make sure you see a form warning that the Message is a required field. (NOTE: you will be redirected to the advanced discussion form) Attempt to create a discussion from the advanced discussion creation form. Enter a subject Leave the message empty Click "Post to forum" make sure you do not see any DB errors make sure you see a form warning that the Message is a required field
    • Affected Branches:
      MOODLE_37_STABLE
    • Fixed Branches:
      MOODLE_37_STABLE
    • Epic Link:
    • Pull Master Branch:
      MDL-65468-master

      Description

      1. Given I open a forum
      2. And I click "Create a new discussion topic"
      3. And I set the "Subject" to "Example"
      4. And I do not fill the "Message" field
      5. When I click on "Post to forum"
      6. Then I should see a form warning that the Message is a required field
      7. But I see a DB error

        Debug info: ERROR: null value in column "subject" violates not-null constraint
        DETAIL: Failing row contains (31, 0, 0, 2, 1556764614, 1556764614, 0, null, , null, 0, , 0, 0, 0, 0).
        INSERT INTO mdl_forum_posts (discussion,parent,privatereplyto,userid,created,modified,mailed,subject,message,messageformat,messagetrust,mailnow) VALUES($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12) RETURNING id
        [array (
        'discussion' => 0,
        'parent' => 0,
        'privatereplyto' => 0,
        'userid' => '2',
        'created' => 1556764614,
        'modified' => 1556764614,
        'mailed' => 0,
        'subject' => NULL,
        'message' => '',
        'messageformat' => NULL,
        'messagetrust' => 0,
        'mailnow' => 0,
        )]
        Error code: dmlwriteexception
        

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                20/May/19

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 hours, 35 minutes
                2h 35m