Skip to content

Commit

Permalink
Survey: Fix possible "Undefined offset" warning in surveyUtil.class.php
Browse files Browse the repository at this point in the history
  • Loading branch information
LudiscapeXApi authored Oct 12, 2024
1 parent 8d76d00 commit 8c27c9d
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions main/survey/surveyUtil.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1604,13 +1604,15 @@ public static function display_complete_report_row(
} else {
foreach ($possible_option as $option_id => $value) {
if ($questions[$question_id]['type'] === 'multiplechoiceother') {
foreach ($answers_of_user[$question_id] as $key => $newValue) {
$parts = ch_multiplechoiceother::decodeOptionValue($key);
if (isset($parts[0])) {
$data = $answers_of_user[$question_id][$key];
unset($answers_of_user[$question_id][$key]);
$newKey = $parts[0];
$answers_of_user[$question_id][$newKey] = $data;
if (isset($answers_of_user[$question_id])) {
foreach ($answers_of_user[$question_id] as $key => $newValue) {
$parts = ch_multiplechoiceother::decodeOptionValue($key);
if (isset($parts[0])) {
$data = $answers_of_user[$question_id][$key];
unset($answers_of_user[$question_id][$key]);
$newKey = $parts[0];
$answers_of_user[$question_id][$newKey] = $data;
}
}
}
}
Expand Down

0 comments on commit 8c27c9d

Please sign in to comment.