From 5605d643890d711b0c554e35391e1b6a3bbc1743 Mon Sep 17 00:00:00 2001 From: Michael Aherne Date: Tue, 16 Jul 2024 14:39:02 +0100 Subject: [PATCH] MDL-82499 question: Fail if questionid does not exist. --- lib/questionlib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/questionlib.php b/lib/questionlib.php index bffcd5389c6..99a7a2ce6b5 100644 --- a/lib/questionlib.php +++ b/lib/questionlib.php @@ -1465,7 +1465,7 @@ function question_has_capability_on($questionorid, $cap, $notused = -1): bool { WHERE q.id = :id'; // Well, at least we tried. Seems that we really have to read from DB. - $question = $DB->get_record_sql($sql, ['id' => $questionid]); + $question = $DB->get_record_sql($sql, ['id' => $questionid], MUST_EXIST); } }