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

Long multibyte course shortname ruins course restoration process (Incorrect string value: '\xD1_1' for column 'shortname' at row 1)

    XMLWordPrintable

Details

    • MySQL
    • MOODLE_39_STABLE
    • MOODLE_400_STABLE, MOODLE_401_STABLE
    • MDL-75789-400
    • MDL-75789-401
    • Hide

      Testing on MySQL (although other DBs may be affected)

      1. Log in as admin
      2. Navigate to Courses > Restore courses in site administration
      3. Upload backup-moodle2-course-MDL-75789.tar.gz
      4. Progress through restore process, selecting Restore as a new course
      5. Confirm course is restored correctly
      6. Navigate back to Courses > Restore courses in site administration
      7. Upload backup-moodle2-course-MDL-75789.tar.gz (again, we are going to now test duplicate name resolution is working)
      8. Perform the same process as above, to Restore as a new course
      9. Confirm course is restored correctly
      10. Go to Settings in second restored course
      11. Confirm Course full name contains " copy 1" postfix
      12. Confirm Course short name contains "_1" postfix
      Show
      Testing on MySQL (although other DBs may be affected) Log in as admin Navigate to Courses > Restore courses in site administration Upload backup-moodle2-course-MDL-75789.tar.gz Progress through restore process, selecting Restore as a new course Confirm course is restored correctly Navigate back to Courses > Restore courses in site administration Upload backup-moodle2-course-MDL-75789.tar.gz (again, we are going to now test duplicate name resolution is working) Perform the same process as above, to Restore as a new course Confirm course is restored correctly Go to Settings in second restored course Confirm Course full name contains " copy 1" postfix Confirm Course short name contains "_1" postfix

    Description

      Problem:

      If shortname of a course is longer than 100 bytes, Moodle cuts everything after 100th byte off during course restoration process. The database cannot write course shortname with a multibyte symbol split in two in it.

      Error:

      Error writing to database
      More information about this error

      Debug info: Incorrect string value: '\xD1_1' for column 'shortname' at row 1
      UPDATE mdl_course SET shortname = ?,fullname = ?,idnumber = ?,summary = ?,summaryformat = ?,format = ?,showgrades = ?,newsitems = ?,startdate = ?,enddate = ?,marker = ?,maxbytes = ?,legacyfiles = ?,showreports = ?,visible = ?,groupmode = ?,groupmodeforce = ?,defaultgroupingid = ?,lang = ?,theme = ?,timecreated = ?,timemodified = ?,requested = ?,enablecompletion = ?,completionnotify = ? WHERE id=?
      [array (
      0 => '1ыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыы�_1',
      1 => 'ЫЫЫ copy 1',
      2 => '',
      3 => '',
      4 => '1',
      5 => 'topics',
      6 => '1',
      7 => '5',
      8 => 1663621200,
      9 => 1695157200,
      10 => '0',
      11 => '0',
      12 => '0',
      13 => '0',
      14 => '1',
      15 => '0',
      16 => '0',
      17 => '0',
      18 => '',
      19 => '',
      20 => '1663584365',
      21 => '1663584365',
      22 => '0',
      23 => '1',
      24 => '0',
      25 => 18,
      )]
      Error code: dmlwriteexception

      Stack trace:

      line 489 of /lib/dml/moodle_database.php: dml_write_exception thrown
      line 1587 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
      line 1619 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->update_record_raw()
      line 1920 of /backup/moodle2/restore_stepslib.php: call to mysqli_native_moodle_database->update_record()
      line 137 of /backup/util/plan/restore_structure_step.class.php: call to restore_course_structure_step->process_course()
      line 121 of /backup/util/helper/restore_structure_parser_processor.class.php: call to restore_structure_step->process()
      line 178 of /backup/util/xml/parser/processors/grouped_parser_processor.class.php: call to restore_structure_parser_processor->dispatch_chunk()
      line 109 of /backup/util/helper/restore_structure_parser_processor.class.php: call to grouped_parser_processor->postprocess_chunk()
      line 148 of /backup/util/xml/parser/processors/simplified_parser_processor.class.php: call to restore_structure_parser_processor->postprocess_chunk()
      line 92 of /backup/util/xml/parser/processors/progressive_parser_processor.class.php: call to simplified_parser_processor->process_chunk()
      line 190 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser_processor->receive_chunk()
      line 237 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser->publish()
      line ? of unknownfile: call to progressive_parser->start_tag()
      line 179 of /backup/util/xml/parser/progressive_parser.class.php: call to xml_parse()
      line 158 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser->parse()
      line 110 of /backup/util/plan/restore_structure_step.class.php: call to progressive_parser->process()
      line 181 of /backup/util/plan/base_task.class.php: call to restore_structure_step->execute()
      line 191 of /backup/util/plan/base_plan.class.php: call to base_task->execute()
      line 168 of /backup/util/plan/restore_plan.class.php: call to base_plan->execute()
      line 394 of /backup/controller/restore_controller.class.php: call to restore_plan->execute()
      line 219 of /backup/util/ui/restore_ui.class.php: call to restore_controller->execute_plan()
      line 143 of /backup/restore.php: call to restore_ui->execute()

      Steps:

      1. Create a course with the following shortname: "1ыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыы" ("1" or any other single byte symbol is required in the beginning to split a multibyte symbol at 100th byte)
      2. Create a backup of the course.
      3. Restore the backup.


      Extra information:

      The backup file contains correct (full) course shortname. The file included.

      Attachments

        Activity

          People

            pholden Paul Holden
            андрейусков Андрей Усков
            Raquel Ortega Raquel Ortega
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            Kim Jared Lucas Kim Jared Lucas
            Adrian Greeve, David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo, Amaia Anabitarte, Carlos Escobedo, Laurent David, Mikel Martín Corrales, Sabina Abellan, Sara Arjona (@sarjona)
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              16/Jan/23

              Time Tracking

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