Skip to content

Commit 8c27c9d

Browse files
Survey: Fix possible "Undefined offset" warning in surveyUtil.class.php
1 parent 8d76d00 commit 8c27c9d

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

main/survey/surveyUtil.class.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1604,13 +1604,15 @@ public static function display_complete_report_row(
16041604
} else {
16051605
foreach ($possible_option as $option_id => $value) {
16061606
if ($questions[$question_id]['type'] === 'multiplechoiceother') {
1607-
foreach ($answers_of_user[$question_id] as $key => $newValue) {
1608-
$parts = ch_multiplechoiceother::decodeOptionValue($key);
1609-
if (isset($parts[0])) {
1610-
$data = $answers_of_user[$question_id][$key];
1611-
unset($answers_of_user[$question_id][$key]);
1612-
$newKey = $parts[0];
1613-
$answers_of_user[$question_id][$newKey] = $data;
1607+
if (isset($answers_of_user[$question_id])) {
1608+
foreach ($answers_of_user[$question_id] as $key => $newValue) {
1609+
$parts = ch_multiplechoiceother::decodeOptionValue($key);
1610+
if (isset($parts[0])) {
1611+
$data = $answers_of_user[$question_id][$key];
1612+
unset($answers_of_user[$question_id][$key]);
1613+
$newKey = $parts[0];
1614+
$answers_of_user[$question_id][$newKey] = $data;
1615+
}
16141616
}
16151617
}
16161618
}

0 commit comments

Comments
 (0)