From 958f5eea7a8af1435723744e91146f1f5661519f Mon Sep 17 00:00:00 2001 From: Alexander Killing Date: Mon, 22 Apr 2024 16:36:50 +0200 Subject: [PATCH] Fix: Type error. ilObjSurvey::getAnonymousIdByCode() (#7410) TypeError thrown with message "Return value of ilObjSurvey::getAnonymousIdByCode() must be of the type int, null returned" Stacktrace: #9 TypeError in /var/www/html/Modules/Survey/classes/class.ilObjSurvey.php:4702 #8 ilObjSurvey:getAnonymousIdByCode in /var/www/html/Modules/Survey/Execution/class.ilSurveyExecutionGUI.php:175 #7 ilSurveyExecutionGUI:checkAuth in /var/www/html/Modules/Survey/Execution/class.ilSurveyExecutionGUI.php:354 #6 ilSurveyExecutionGUI:outSurveyPage in /var/www/html/Modules/Survey/Execution/class.ilSurveyExecutionGUI.php:280 #5 ilSurveyExecutionGUI:redirectQuestion in /var/www/html/Modules/Survey/Execution/class.ilSurveyExecutionGUI.php:140 #4 ilSurveyExecutionGUI:executeCommand in /var/www/html/Services/UICore/classes/class.ilCtrl.php:199 #3 ilCtrl:forwardCommand in /var/www/html/Modules/Survey/classes/class.ilObjSurveyGUI.php:206 #2 ilObjSurveyGUI:executeCommand in /var/www/html/Services/UICore/classes/class.ilCtrl.php:199 #1 ilCtrl:forwardCommand in /var/www/html/Services/UICore/classes/class.ilCtrl.php:174 #0 ilCtrl:callBaseClass in /var/www/html/ilias.php:24 --- components/ILIAS/Survey/classes/class.ilObjSurvey.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/ILIAS/Survey/classes/class.ilObjSurvey.php b/components/ILIAS/Survey/classes/class.ilObjSurvey.php index 6c623df77c3c..08ba4161b95d 100755 --- a/components/ILIAS/Survey/classes/class.ilObjSurvey.php +++ b/components/ILIAS/Survey/classes/class.ilObjSurvey.php @@ -4684,13 +4684,13 @@ public function getAppraiseesToRate( */ public function getAnonymousIdByCode( string $a_code - ): int { + ): ?int { $ilDB = $this->db; $set = $ilDB->query("SELECT anonymous_id FROM svy_anonymous" . " WHERE survey_fi = " . $ilDB->quote($this->getSurveyId(), "integer") . " AND survey_key = " . $ilDB->quote($a_code, "text")); $res = $ilDB->fetchAssoc($set); - return $res["anonymous_id"]; + return $res["anonymous_id"] ?? null; } /**