diff options
-rwxr-xr-x | phpBB/bin/phpbbcli.php | 1 | ||||
-rw-r--r-- | phpBB/includes/message_parser.php | 2 | ||||
-rw-r--r-- | tests/functional/posting_test.php | 16 |
3 files changed, 18 insertions, 1 deletions
diff --git a/phpBB/bin/phpbbcli.php b/phpBB/bin/phpbbcli.php index 804a7e09a0..2bca6e7b89 100755 --- a/phpBB/bin/phpbbcli.php +++ b/phpBB/bin/phpbbcli.php @@ -42,6 +42,7 @@ require($phpbb_root_path . 'includes/constants.' . $phpEx); require($phpbb_root_path . 'includes/functions.' . $phpEx); require($phpbb_root_path . 'includes/functions_admin.' . $phpEx); require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); +require($phpbb_root_path . 'includes/functions_compatibility.' . $phpEx); $phpbb_container_builder = new \phpbb\di\container_builder($phpbb_root_path, $phpEx); $phpbb_container = $phpbb_container_builder->with_config($phpbb_config_php_file); diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index 5b585d4237..c68ff87cd7 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -1860,7 +1860,7 @@ class parse_message extends bbcode_firstpass // Parse Poll Option text $tmp_message = $this->message; - $poll['poll_options'] = explode("\n", trim($poll['poll_option_text'])); + $poll['poll_options'] = preg_split('/\s*?\n\s*/', trim($poll['poll_option_text'])); $poll['poll_options_size'] = sizeof($poll['poll_options']); foreach ($poll['poll_options'] as &$poll_option) diff --git a/tests/functional/posting_test.php b/tests/functional/posting_test.php index bf9e3eb51a..9dd8a1dc91 100644 --- a/tests/functional/posting_test.php +++ b/tests/functional/posting_test.php @@ -159,6 +159,22 @@ class phpbb_functional_posting_test extends phpbb_functional_test_case } } + public function test_post_poll() + { + $this->login(); + + $post = $this->create_topic( + 2, + '[ticket/14802] Test Poll Option Spacing', + 'Empty/blank lines should not be additional poll options.', + array('poll_title' => 'Poll Title', 'poll_option_text' => "\n A \nB\n\nC \n D\nE\n\n \n") + ); + + $crawler = self::request('GET', "viewtopic.php?t={$post['topic_id']}&sid={$this->sid}"); + $this->assertEquals('Poll Title', $crawler->filter('.poll-title')->text()); + $this->assertEquals(5, $crawler->filter('*[data-poll-option-id]')->count()); + } + protected function set_quote_depth($depth) { $crawler = self::request('GET', 'adm/index.php?sid=' . $this->sid . '&i=acp_board&mode=post'); |