MyBB Community Forums
[Pushed] Extra </li> in lists output by the parser - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Development (https://community.mybb.com/forum-161.html)
+--- Forum: MyBB 1.8 Development (https://community.mybb.com/forum-165.html)
+---- Forum: 1.8 Bugs and Issues (https://community.mybb.com/forum-157.html)
+----- Forum: Pushed (https://community.mybb.com/forum-183.html)
+----- Thread: [Pushed] Extra </li> in lists output by the parser (/thread-217027.html)



Extra </li> in lists output by the parser - Laird - 2018-04-17

It seems that the parser is outputting an extra </li> before the first element of a list.

Here's a suggested patch to fix the issue -  I haven't filed it as a PR because I understand that protocol is to report bugs here first.

In inc/class_parser.php, in function mycode_parse_list(), replace:

 		$message = preg_replace("#[^\S\n\r]*\[\*\]\s*#", "</li>\n<li>", $message);
		$message .= "</li>";


with:

		$a = preg_split("#[^\S\n\r]*\[\*\]\s*#", $message);
		if(isset($a[0]) && trim($a[0]) == '')
		{
			array_shift($a);
		}
		$message = '<li>'.implode("</li>\n<li>", $a)."</li>\n";



RE: Extra </li> in lists output by the parser - effone - 2018-04-17

I can confirm the issue.
Though there is no visual impact but looking at the output source its evident.


RE: Extra </li> in lists output by the parser - Euan T - 2018-04-17

Good catch, I never noticed this before. I'm pushing this to GitHub now.


RE: Extra </li> in lists output by the parser - Euan T - 2018-04-17

Hi,

Thank you for your report. We have pushed this issue to our Github repository for further analysis where you can track our commits and progress with fixing this bug. Discussions regarding this bug may also take place there too.

Follow this link to visit the issue on Github: https://github.com/mybb/mybb/issues/3128

Thanks for contributing to MyBB!

Regards,
The MyBB Group