From 77a5e1008ca88ea948335e0039a3e334f2bccd13 Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Wed, 2 Dec 2020 13:22:22 -0500 Subject: [PATCH] Quiz: Fix save oral expression question #3691 --- main/exercise/exercise.class.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/main/exercise/exercise.class.php b/main/exercise/exercise.class.php index 74a7bd6a07..f9eff830bd 100755 --- a/main/exercise/exercise.class.php +++ b/main/exercise/exercise.class.php @@ -4488,10 +4488,20 @@ class Exercise "; $resq = Database::query($query); $row = Database::fetch_assoc($resq); - $choice = $row['answer']; - $choice = str_replace('\r\n', '', $choice); - $choice = stripslashes($choice); - $questionScore = $row['marks']; + + $choice = [ + 'answer' => '', + 'marks' => 0, + ]; + $questionScore = 0; + + if (is_array($row)) { + $choice = $row['answer']; + $choice = str_replace('\r\n', '', $choice); + $choice = stripslashes($choice); + $questionScore = $row['marks']; + } + if ($questionScore == -1) { $totalScore += 0; } else {