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

No handling of too long course names in restore process

XMLWordPrintable

    • MOODLE_34_STABLE

      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

            Unassigned Unassigned
            tobias.reischmann Tobias Reischmann
            Votes:
            7 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.