From bdd8770347f850575b2ab73eee9fcbcb62bb3700 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luca=20B=C3=B6sch?= Date: Fri, 13 Sep 2024 11:20:48 +0200 Subject: [PATCH] MDL-83127 qtype_ordering: handle NULL in question_hints table entries. --- .../ordering/classes/question_hint_ordering.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/question/type/ordering/classes/question_hint_ordering.php b/question/type/ordering/classes/question_hint_ordering.php index f6c2fc5e430..4ae2ba81a68 100644 --- a/question/type/ordering/classes/question_hint_ordering.php +++ b/question/type/ordering/classes/question_hint_ordering.php @@ -54,9 +54,16 @@ class question_hint_ordering extends question_hint_with_parts { global $DB; // Initialize with the old questions. - if (is_null($row->options) || is_null($row->shownumcorrect)) { - $row->options = 1; - $row->shownumcorrect = 1; + if (is_null($row->options) || is_null($row->shownumcorrect) || is_null($row->clearwrong)) { + if (is_null($row->options)) { + $row->options = 1; + } + if (is_null($row->shownumcorrect)) { + $row->shownumcorrect = 1; + } + if (is_null($row->clearwrong)) { + $row->clearwrong = 1; + } $DB->update_record('question_hints', $row); }