-
Type:
Bug
-
Status: Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 3.2.6, 3.3.1, 3.4, 3.5.2, 3.6
-
Component/s: Questions
-
Testing Instructions:
-
Affected Branches:MOODLE_32_STABLE, MOODLE_33_STABLE, MOODLE_34_STABLE, MOODLE_35_STABLE, MOODLE_36_STABLE
-
Fixed Branches:MOODLE_34_STABLE, MOODLE_35_STABLE
-
Pull from Repository:
-
Pull 3.5 Branch:
MDL-60897-35 -
Pull 3.5 Diff URL:
-
Pull Master Branch:
MDL-60897-master -
Pull Master Diff URL:
On Moodle 3.3.x and 3.2.x (and probably earlier versions), we regularly notice an error that prevents us from exporting questions from the question bank / copying courses / importing quizzes into other courses. After going through all questions in the question bank, we found out that a couple of the cloze-questions were corrupted and therefore prevented the export / copying / importing from working properly. Unlike other issues here in the tracker which suggest that the questions were corrupted in an earlier ID-mapping during restore (e.g. https://tracker.moodle.org/browse/MDL-54724), our cloze-questions were corrupted from the beginning.
We could reproduce the issue by doing the following :
- Create new Cloze question (Multichoice) and fill in ONLY ONE choice, then save the question
- Moodle announces that at least two options need to be given
- When continuing, however, we do not get the possibility to fix the problem, but « error/question/missingcourseorcmid » appears instead and we eventually get back to the dashboard
- When we go back to the quiz, the question does not appear as part of the quiz, it does however, appear in the question bank.
- When we now try to export the question bank, the export will fail because of the corrupted cloze-question. There is also a problem when we try to copy the course or try to import the quiz into another course:
ERROR: invalid input syntax for integer: ""
SELECT * FROM mdl_question WHERE id = $1 ORDER BY id ASC
[array (
0 => '
)]
Error code: dmlreadexception
To avoid this error, Moodle should not save invalid cloze-questions at all, but should instead force the user to enter a correct cloze-question (or abort the saving of the invalid cloze question in the question bank).