Fork me on GitHub
Subscribe 6

Ticket #685 (fixed bug)

BBCode bug

  • Created: 2012-06-20 02:47:43
  • Reported by: jacob
  • Assigned to: quy
  • Milestone: 1.5.1
  • Component: parser
  • Priority: high

Type it in, and it produces the code in this post.


arw 2012-06-20 09:19:32

solved if :

	$temp_text = false;
	if (empty($errors))
		$temp_text = preparse_tags($text, $errors, $is_signature);

	if ($temp_text !== false)
		$text = $temp_text;

moved after " // Remove empty tags " ( and the block following that ) but if don't know if there may be issue doing that

for example if "// Tags we can automatically fix bad nesting" renested well with empty tags ( i don't know if it can be possible ), they would stay

Comment edited 1 times (Diff)

Franz 2012-06-20 12:34:31

  • Component changed from code to parser.
  • Milestone set to 1.5.1.

Franz 2012-06-21 09:19:12

Strange, the test topic makes me think that this breaks the quote depth limit also...

Comment edited 1 times (Diff)

arw 2012-06-21 09:31:40

issue is :

  • message [ quo[ b][ /b]te] [ quo[ b][ /b]te] [ quo[ b][ /b]te] posted

  • bbcode are parsed in preparse_tags() : only [ b][ /b] is found several times and is ok

  • empty bbcode are removed : message become  [ quote] [ quote] [ quote]

the quote depth limit ( which is in preparse_tags() ) will not work since at that moment there is no quote

it should either be :

  • message [ quo[ b][ /b]te] [ quo[ b][ /b]te] [ quo[ b][ /b]te] posted

  • empty bbcode are removed : message become  [ quote] [ quote] [ quote]

  • bbcode are parsed in preparse_tags() : error [ quote] but no [ /quote]

  • empty bbcode are removed : maybe it would be needed again, if preparse_tags could create new empty tags

or empty tags should not be removed

on other forum system, i often do things like [ qu[ b][ /b]ote] when i want to  just show the tag ( or overcome censorship )

Comment edited 1 times (Diff)

Franz 2012-06-21 10:08:25

I would argue BBCode tags inside other tags should just not be allowed.

arw 2012-06-21 10:41:39

this now :






outputs :











i think it's what someone would expect, if there is no [quote] it's not a [quote] so i don't think there sould be an error :

"a tag can't be after a [ character"

Studio384 2012-09-12 12:21:21

I don't know if you notice this to, but every post that's using this bug get this: … ff-bug.png

See the position of "Offline", it's in the post itself.

adaur 2012-10-19 18:46:54


$text = preparse_tags($text, $errors, $is_signature); // Re-preparse message


	// Remove empty tags
	while (($new_text = strip_empty_bbcode($text)) !== false)
		if ($new_text != $text)
			$text = $new_text;
			if ($new_text == '')
				$errors[] = $lang_post['Empty after strip'];

as arw suggested fixes the bug (at least the [quo [b ][ /b] te] and [ quo[ b][ / b]te] [ quo[ b][ /b]te] [ quo[  b][ /b]te]. Would it be this simple ?

jacob 2012-10-19 18:53:22

A possible solution would be to keep running the function until all empty BBCode has been removed.

adaur 2012-10-31 10:42:28

I tried to do as you suggested jacob, with no luck. Preparsing a second time the message should be enough, IMO.

quy 2012-11-12 16:06:31

I think the solution is to also perform "Remove empty tags" code before:

	$temp_text = false;
	if (empty($errors))
		$temp_text = preparse_tags($text, $errors, $is_signature);

Franz 2012-11-12 23:35:24

Is that a patch, Quy? If so, go for it. smile

quy 2012-11-13 03:18:01

Commit 9c3acc4 to fluxbb master

#685: Remove empty BBCode tags inside other BBCode tags before preparsing to prevent issues such as orphan tags.

quy 2012-11-13 03:20:25

  • Owner set to quy.
  • Status changed from open to fixed.

Franz 2012-11-13 10:06:01

This doesn't work yet.

I updated the site with the new code and the topic still doesn't display correctly.

Franz 2012-11-13 10:06:10

  • Status changed from fixed to open.

quy 2012-11-13 13:58:25

  • Status changed from open to fixed.

Because it has already been parsed and indirectly generated an orphan tag which it shouldn't have in the first place and saved in the database. It does work with new postings and editing of existings postings.

Franz 2012-11-13 14:23:34

My bad. Let me go and fix that topic in the database. smile