mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
[ticket/13522] Remove empty answers from possible answers in Q&A
PHPBB3-13522
This commit is contained in:
parent
9cdbb69f9e
commit
9a03b3aab6
1 changed files with 11 additions and 2 deletions
|
@ -827,13 +827,22 @@ class qa
|
|||
function acp_get_question_input()
|
||||
{
|
||||
$answers = utf8_normalize_nfc(request_var('answers', '', true));
|
||||
|
||||
// Convert answers into array and filter if answers are set
|
||||
if (strlen($answers))
|
||||
{
|
||||
$answers = array_filter(explode("\n", $answers), function ($value) {
|
||||
return trim($value) !== '';
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
$question = array(
|
||||
'question_text' => request_var('question_text', '', true),
|
||||
'strict' => request_var('strict', false),
|
||||
'lang_iso' => request_var('lang_iso', ''),
|
||||
'answers' => (strlen($answers)) ? explode("\n", $answers) : '',
|
||||
'answers' => $answers,
|
||||
);
|
||||
|
||||
return $question;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue