Skip to content

Commit

Permalink
Fix: Type error. ilObjSurvey::getAnonymousIdByCode() (#7410)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
alex40724 committed Apr 22, 2024
1 parent 62f1680 commit 958f5ee
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions components/ILIAS/Survey/classes/class.ilObjSurvey.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down

0 comments on commit 958f5ee

Please sign in to comment.