File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1860,7 +1860,7 @@ function parse_poll(&$poll)
18601860 // Parse Poll Option text
18611861 $ tmp_message = $ this ->message ;
18621862
1863- $ poll ['poll_options ' ] = explode ( "\n" , trim ($ poll ['poll_option_text ' ]));
1863+ $ poll ['poll_options ' ] = preg_split ( ' /\s*?\n\s*/ ' , trim ($ poll ['poll_option_text ' ]));
18641864 $ poll ['poll_options_size ' ] = sizeof ($ poll ['poll_options ' ]);
18651865
18661866 foreach ($ poll ['poll_options ' ] as &$ poll_option )
Original file line number Diff line number Diff line change @@ -159,6 +159,22 @@ public function test_quote_depth_submit()
159159 }
160160 }
161161
162+ public function test_post_poll ()
163+ {
164+ $ this ->login ();
165+
166+ $ post = $ this ->create_topic (
167+ 2 ,
168+ '[ticket/14802] Test Poll Option Spacing ' ,
169+ 'Empty/blank lines should not be additional poll options. ' ,
170+ array ('poll_title ' => 'Poll Title ' , 'poll_option_text ' => "\n A \nB \n\nC \n D \nE \n\n \n" )
171+ );
172+
173+ $ crawler = self ::request ('GET ' , "viewtopic.php?t= {$ post ['topic_id ' ]}&sid= {$ this ->sid }" );
174+ $ this ->assertEquals ('Poll Title ' , $ crawler ->filter ('.poll-title ' )->text ());
175+ $ this ->assertEquals (5 , $ crawler ->filter ('*[data-poll-option-id] ' )->count ());
176+ }
177+
162178 protected function set_quote_depth ($ depth )
163179 {
164180 $ crawler = self ::request ('GET ' , 'adm/index.php?sid= ' . $ this ->sid . '&i=acp_board&mode=post ' );
You can’t perform that action at this time.
0 commit comments