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

    • MySQL
    • MOODLE_39_STABLE
    • MOODLE_400_STABLE, MOODLE_401_STABLE
    • 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

      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.

        1. (I) 11 Passed -- (400)MDL-75789.png
          39 kB
          Kim Jared Lucas
        2. (I) 11 Passed -- (401)MDL-75789.png
          44 kB
          Kim Jared Lucas
        3. (I) 11 Passed -- (master)MDL-75789.png
          40 kB
          Kim Jared Lucas
        4. (I) 12 Passed -- (400)MDL-75789.png
          39 kB
          Kim Jared Lucas
        5. (I) 12 Passed -- (401)MDL-75789.png
          44 kB
          Kim Jared Lucas
        6. (I) 12 Passed -- (master)MDL-75789.png
          44 kB
          Kim Jared Lucas
        7. (I) 5 Passed -- (400)MDL-75789.png
          35 kB
          Kim Jared Lucas
        8. (I) 5 Passed -- (401)MDL-75789.png
          35 kB
          Kim Jared Lucas
        9. (I) 5 Passed -- (master)MDL-75789.png
          33 kB
          Kim Jared Lucas
        10. (I) 9 Passed -- (400)MDL-75789.png
          36 kB
          Kim Jared Lucas
        11. (I) 9 Passed -- (401)MDL-75789.png
          35 kB
          Kim Jared Lucas
        12. (I) 9 Passed -- (master)MDL-75789.png
          35 kB
          Kim Jared Lucas
        13. 01-MDL-75789_RestoreCourse.png
          43 kB
          Raquel Ortega
        14. 02-MDL-75789_RestoreCourse.png
          41 kB
          Raquel Ortega
        15. backup-moodle2-course-17-1ыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыыы-20220919-1348-nu-nf.mbz
          3 kB
          Андрей Усков
        16. backup-moodle2-course-MDL-75789.tar.gz
          3 kB
          Paul Holden
        17. Screenshot_20220919_134654.png
          186 kB
          Андрей Усков
        18. Screenshot_20220919_134806.png
          99 kB
          Андрей Усков
        19. Screenshot_20220919_134958.png
          165 kB
          Андрей Усков
        20. Screenshot_20220919_135142.png
          126 kB
          Андрей Усков
        21. Screenshot_20220919_135236.png
          154 kB
          Андрей Усков
        22. Screenshot 2022-09-23 at 10.55.17.png
          101 kB
          Carlos Escobedo
        23. Screenshot 2022-09-23 at 10.56.48.png
          101 kB
          Carlos Escobedo

            pholden Paul Holden
            андрейусков Андрей Усков
            Raquel Ortega Raquel Ortega
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            Kim Jared Lucas Kim Jared Lucas
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved:

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

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