Affects Version/s: 2.3, 3.4
Testing instructions: Log into Moodle as Admin Create a new / use an existing Moodle Course Select Backup option for Moodle Course Go through the Backup workflow (don't use the "Jump to final step" shortcut) Specify a MBZ filename with over 255 characters long on step 3. "Confirmation and review" You should receive an error validation message after clicking on "Perform backup" button saying: "The filename length you enter must be less than 255 characters" You should not receive an un-handled error message as previously reported
- Log into Moodle as Admin
- Create a new / use an existing Moodle Course
- Select Backup option for Moodle Course
- Go through the Backup workflow (don't use the "Jump to final step" shortcut)
- Specify a MBZ filename with over 255 characters long on step 3. "Confirmation and review"
- You should receive an error validation message after clicking on "Perform backup" button saying: "The filename length you enter must be less than 255 characters"
- You should not receive an un-handled error message as previously reported
Affected Branches:MOODLE_23_STABLE, MOODLE_34_STABLE
Fixed Branches:MOODLE_33_STABLE, MOODLE_34_STABLE
Pull from Repository:
Pull 3.4 Branch:
Pull 3.4 Diff URL:
Pull Master Branch:
Pull Master Diff URL:
Moodle generates an exception when the user enters a really long filename as the name of a backup file. The filename column in mdl_files is varchar (255). If you exceed 255 characters, the exception generated is not handled by Moodle. A generic error is produced that, unless debug is turned on, doesn't tell the user what is broken.
I sincerely doubt this is a regression bug caused by any 2.3 changes!!
- An existing course with plenty of data.
- Backup the course and enter more than 255 characters as the filename of the backup.
- Moodle gracefully informs the user that the filename is too long.
- Moodle generates the following error:
Can not create file "31/backup/course/0///123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-12.mbz"
More information about this error
Debug info: Data too long for column 'filename' at row 1
INSERT INTO mdl_files (contextid,component,filearea,itemid,filepath,filename,timecreated,timemodified,mimetype,userid,source,author,license,status,sortorder,filesize,contenthash,pathnamehash) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
0 => '31',
1 => 'backup',
2 => 'course',
3 => 0,
4 => '/',
5 => '123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-12.mbz',
6 => 1340177941,
7 => 1340177941,
8 => 'application/vnd.moodle.backup',
9 => '2',
10 => NULL,
11 => NULL,
12 => NULL,
13 => 0,
14 => 0,
15 => 1254809,
16 => 'dae2ae7ef894d6cdc517264f7a77fa0464c81e56',
17 => 'd13cd587ebdd3bfcd10e02dbf7d2067039103df0',
Error code: storedfilenotcreated
line 1049 of /lib/filestorage/file_storage.php: stored_file_creation_exception thrown
line 313 of /backup/util/helper/backup_helper.class.php: call to file_storage->create_file_from_pathname()
line 1595 of /backup/moodle2/backup_stepslib.php: call to backup_helper::store_backup_file()
line 34 of /backup/util/plan/backup_execution_step.class.php: call to backup_store_backup_file->define_execution()
line 153 of /backup/util/plan/base_task.class.php: call to backup_execution_step->execute()
line 146 of /backup/util/plan/base_plan.class.php: call to base_task->execute()
line 110 of /backup/util/plan/backup_plan.class.php: call to base_plan->execute()
line 309 of /backup/controller/backup_controller.class.php: call to backup_plan->execute()
line 111 of /backup/util/ui/backup_ui.class.php: call to backup_controller->execute_plan()
line 89 of /backup/backup.php: call to backup_ui->execute()