MyBB Community Forums

Full Version: Extra </li> in lists output by the parser
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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";
I can confirm the issue.
Though there is no visual impact but looking at the output source its evident.
Good catch, I never noticed this before. I'm pushing this to GitHub now.
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