diff options
author | Marc Alexander <admin@m-a-styles.de> | 2015-01-24 12:49:58 +0100 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2015-01-24 13:09:00 +0100 |
commit | 9a03b3aab6033b52492296730c30849f96f430bf (patch) | |
tree | 8f0580c2312c768e867e629f9d41d13064ddbd09 /phpBB/phpbb/captcha/plugins/qa.php | |
parent | 9cdbb69f9e50f665caad54fc93f64143cb7d8fc8 (diff) | |
download | forums-9a03b3aab6033b52492296730c30849f96f430bf.tar forums-9a03b3aab6033b52492296730c30849f96f430bf.tar.gz forums-9a03b3aab6033b52492296730c30849f96f430bf.tar.bz2 forums-9a03b3aab6033b52492296730c30849f96f430bf.tar.xz forums-9a03b3aab6033b52492296730c30849f96f430bf.zip |
[ticket/13522] Remove empty answers from possible answers in Q&A
PHPBB3-13522
Diffstat (limited to 'phpBB/phpbb/captcha/plugins/qa.php')
-rw-r--r-- | phpBB/phpbb/captcha/plugins/qa.php | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/phpBB/phpbb/captcha/plugins/qa.php b/phpBB/phpbb/captcha/plugins/qa.php index a7ba994cc3..13ff3d7f91 100644 --- a/phpBB/phpbb/captcha/plugins/qa.php +++ b/phpBB/phpbb/captcha/plugins/qa.php @@ -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; } |