- unable to add questions to a quiz
- after debugging turned on, an SQL error complains. Invalid arguments passed to IN() operator like in "questionid IN (,,,,,,,,189,188,187)"
- the field "questions" in mdl_quiz table contains data like ,,,,,189,188,187 (it est missing integers)
The data of the field "questions" got corrupted during a restore procedure. A course backup with a quiz was restored. However, questions used by the quiz were not included in the backup. During the restore, the id of not included question casts to empty string '' which leads to corrupted data in mdl_quiz.questions field.
The reason why the questions were not included in the backup is that all the questions were shared at the course category context. However, at the end of the term, the course were moved out of the category to an archive so it was not descendant of the category containing the questions any more. The quiz itself continued working so the teacher did not notice anything weird. During the backup procedure, the number of questions being backed-up was reported as 0. But it itself is not alarming too much if the backup is done by administrator, for example, who does not know the course so much.
How to reproduce
1. Create a top level category CAT1
2. Create course COURSE under CAT1
3. Create a QUIZ in COURSE containing three or so questions. Save the questions in the context of CAT1
4. Create another top level category CAT2
5. Move the COURSE into CAT2
6. Check the QUIZ still works
7. Backup the COURSE
8. Restore the COURSE into CLONE
9. Try to add a question to the QUIZ in CLONE (with debugging on, of course)