From 6f3281cc510b7a0fa64dd77c146332d599e4e2ef Mon Sep 17 00:00:00 2001 From: mjansen Date: Fri, 20 Dec 2024 10:27:48 +0100 Subject: [PATCH] Test: Fix `\ilTestEvaluationUserData::getAvailablePoints` accesses undefined array keys --- Modules/Test/classes/class.ilTestEvaluationUserData.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Modules/Test/classes/class.ilTestEvaluationUserData.php b/Modules/Test/classes/class.ilTestEvaluationUserData.php index f2c968482d2d..04ae024b09cc 100755 --- a/Modules/Test/classes/class.ilTestEvaluationUserData.php +++ b/Modules/Test/classes/class.ilTestEvaluationUserData.php @@ -383,15 +383,17 @@ public function getReachedPoints(int $pass = 0): float public function getAvailablePoints(int $pass = 0): float { - $available = 0; - if (!is_object($this->passes[$pass])) { + if (!isset($this->passes[$pass])) { $pass = 0; } - if (!is_object($this->passes[$pass])) { + + if (!isset($this->passes[$pass])) { return 0; } + $available = $this->passes[$pass]->getMaxPoints(); $available = round($available, 2); + return $available; }