-
Bug
-
Resolution: Fixed
-
Minor
-
3.9.17
-
MySQL
-
MOODLE_39_STABLE
-
MOODLE_400_STABLE, MOODLE_401_STABLE
-
MDL-75789-401 -
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:
- 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)
- Create a backup of the course.
- Restore the backup.
Extra information:
The backup file contains correct (full) course shortname. The file included.