From 4a370500a9de18646440370a4a4147c006524b28 Mon Sep 17 00:00:00 2001 From: Nils Haagen Date: Tue, 17 Oct 2023 16:03:15 +0200 Subject: [PATCH] SCORM: #38025, check for empty result when checking (Tracking)Permissions --- Modules/Scorm2004/classes/class.ilSCORM2004StoreData.php | 6 +++--- .../ScormAicc/classes/SCORM/class.ilObjSCORMTracking.php | 9 +++------ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Modules/Scorm2004/classes/class.ilSCORM2004StoreData.php b/Modules/Scorm2004/classes/class.ilSCORM2004StoreData.php index 37ffb6114068..d222ca2db557 100755 --- a/Modules/Scorm2004/classes/class.ilSCORM2004StoreData.php +++ b/Modules/Scorm2004/classes/class.ilSCORM2004StoreData.php @@ -1,7 +1,5 @@ @@ -99,7 +99,7 @@ public static function checkIfAllowed(int $packageId, int $userId, int $hash): v array($packageId, $userId, date('Y-m-d H:i:s')) ); $rowtmp = $ilDB->fetchAssoc($res); - if ((int) $rowtmp['hash'] == $hash) { + if ($rowtmp && (int) $rowtmp['hash'] == $hash) { return; } diff --git a/Modules/ScormAicc/classes/SCORM/class.ilObjSCORMTracking.php b/Modules/ScormAicc/classes/SCORM/class.ilObjSCORMTracking.php index a2c5f7b33f63..7be6f5491eb4 100755 --- a/Modules/ScormAicc/classes/SCORM/class.ilObjSCORMTracking.php +++ b/Modules/ScormAicc/classes/SCORM/class.ilObjSCORMTracking.php @@ -1,7 +1,5 @@ @@ -622,10 +622,7 @@ public static function checkIfAllowed(int $packageId, int $userId, int $hash): v array($packageId, $userId, date('Y-m-d H:i:s')) ); $rowtmp = $ilDB->fetchAssoc($res); - if ($rowtmp['hash'] == $hash) { - //ok - do nothing - // die("allowed"); - } else { + if (! ($rowtmp && $rowtmp['hash'] == $hash)) { //output used by api die("not allowed"); }