Skip to content

Commit

Permalink
Merge pull request #7312 from Sesquipedalian/qanda_cast_array
Browse files Browse the repository at this point in the history
Ensures Q&A answers are always an array
  • Loading branch information
live627 committed Feb 20, 2022
2 parents 788363e + fc4e7ce commit f9d00d0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Sources/ManageSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ function ModifyAntispamSettings($return_config = false)
$context['question_answers'][$row['id_question']] = array(
'lngfile' => $lang,
'question' => $row['question'],
'answers' => $smcFunc['json_decode']($row['answers'], true),
'answers' => (array) $smcFunc['json_decode']($row['answers'], true),
);
$context['qa_by_lang'][$lang][] = $row['id_question'];
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Subs-Editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -2069,7 +2069,7 @@ function create_control_verification(&$verificationOptions, $do_test = false)
$id_question = $row['id_question'];
unset ($row['id_question']);
// Make them all lowercase. We can't directly use $smcFunc['strtolower'] with array_walk, so do it manually, eh?
$row['answers'] = $smcFunc['json_decode']($row['answers'], true);
$row['answers'] = (array) $smcFunc['json_decode']($row['answers'], true);
foreach ($row['answers'] as $k => $v)
$row['answers'][$k] = $smcFunc['strtolower']($v);

Expand Down

0 comments on commit f9d00d0

Please sign in to comment.