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

Long quiz names break deletion ad hoc task when questions are backed up

    XMLWordPrintable

Details

    • MOODLE_35_STABLE
    • MOODLE_37_STABLE, MOODLE_38_STABLE
    • bugfix-MDL-67142
    • Easy
    • Hide

      (difficulty: easy, requires teacher access to a course)

      1. Log in as a teacher and go to a course
      2. Turn editing mode on
      3. Add an activity “Quiz” with a super long name, preferably 255 characters
      4. Save it and click on “Edit Quiz”
      5. Add a question, any type, but select the category as “Default for {quiz name}” under “Quiz : {quiz name}”
      6. Verify that “Default for {quiz name}” category name has been shortened slightly, so that it does not overflow the 255 char limit on category names
      7. Save the question
      8. Go to "site administration" and go to "manage courses & categories"
      9. Move the particular course to another category
      10. Now delete the course
      11. Verify that there is no database error caused by something being longer than 255 characters
      Show
      (difficulty: easy, requires teacher access to a course) Log in as a teacher and go to a course Turn editing mode on Add an activity “Quiz” with a super long name, preferably 255 characters Save it and click on “Edit Quiz” Add a question, any type, but select the category as “Default for {quiz name}” under “Quiz : {quiz name}” Verify that “Default for {quiz name}” category name has been shortened slightly, so that it does not overflow the 255 char limit on category names Save the question Go to "site administration" and go to "manage courses & categories" Move the particular course to another category Now delete the course Verify that there is no database error caused by something being longer than 255 characters

    Description

      When deleting a quiz, if some of the questions should be saved and the quiz name is very long, the database will error when attempting to create the new category for the saved questions.  I believe that this is because it is prepended with the string:

      "Questions saved from context {quiz name}".

        If the quiz name was approaching the database field, then the additional "Questions saved..." string will push it over and cause an error, stopping the ad hoc task from completing. 

      This appears to be happening in lib/questionlib.php:500.

      Attachments

        Activity

          People

            AngadSethi Angad Sethi
            schiem Michael Yoder
            Tim Hunt Tim Hunt
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            Janelle Barcega Janelle Barcega
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              9/Mar/20

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 37 minutes
                37m