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

No handling of too long course names in restore process

    XMLWordPrintable

    Details

    • Affected Branches:
      MOODLE_34_STABLE

      Description

      When you perform a restore of a course, which fully exhausts the character limit for the course name of 254 characters, the restore process will concat 'copy' together with a counter to the course name, as long as the course name already exists.

      However, the length of the course name is never checked for sanity according to the database limit of 254 characters. Neither when the user can set the course name within the restore process, nor when in retore_dbops.class.php:1686 the function calculate_course_names actually calculates the name of the new course.

      The result for the user is that a error message 'Error writing to database' is displayed, without helpful information about what just happened and why and how to fix it.

      Steps to reproduce (from comments below):

      1. As a manager (or admin), create a backup of a course
      2. As a manager (or admin), restore the course backup as a new course (you need to be manager or admin for that)
      3. specify the name of the course, with something very long. I've used this : "A very long title of a marvelous Moodle course about possible bugs in latests versions with very long names of backup filenames (of course, this don't occure very often, but can occure, and it's really a bad thing). So, when it's more than 254 characters long, it generate an error."
      4. do the restore, and you'll see the error

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              tobias.reischmann Tobias Reischmann
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
              Votes:
              7 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated: