From 9b38aca0ce3ddad5ac51c480ded689a07cbf92c0 Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Tue, 29 Apr 2014 11:41:16 +0100 Subject: [PATCH] MDL-45321 quiz upgrade: make it more tolerant to old bad data. --- mod/quiz/db/upgrade.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mod/quiz/db/upgrade.php b/mod/quiz/db/upgrade.php index 7cfab3b78b3..21f4508f9da 100644 --- a/mod/quiz/db/upgrade.php +++ b/mod/quiz/db/upgrade.php @@ -588,6 +588,14 @@ function xmldb_quiz_upgrade($oldversion) { continue; } + if ($questionid === '') { + // This can happen as the result of old restore bugs. + // There can be a missing number in the list of ids. + // All we can do about this is ignore it, which is what + // the quiz system used to do. See MDL-45321. + continue; + } + if (array_key_exists($questionid, $questionidtoslotrowid)) { // Normal case. quiz_slots entry is present. // Just need to add slot and page.