Simple Machines Community Forum

SMF Development => Bug Reports => Fixed or Bogus Bugs => Topic started by: @rjen on September 28, 2016, 08:28:45 AM

Title: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: @rjen on September 28, 2016, 08:28:45 AM
Yesterday I patched my forum to version 2.0.12. All looked fine, but now I get reports from users that they are having problems updating posts made previously that contain certain tables.

When updating these posts, the system incorrectly issues the message:

Quote
The following error or errors occurred while posting this message:
The message body was left empty.

I reverted back to 2.0.11 and the problem is gone. Now I tried to post the same data on this forum and it has the same problem!
I did some tests to find that the version 2.0.12 does not allow me to use a horizontal line ( [h r] ) inside a table cell. It immediately throws above error message and I cannot save the post.

This works:

Member(s)
NameNicknameCity
Persons
Motorcycles
Member1column 1column 2


This does NOT work:
(I put spaces in the bbc code for it to display)

Member(s)
[h r]Name[h r][h r]Nickname[h r][h r]City[h r][h r]Persons[h r][h r]Motorcycles[h r]
Membercolumn 1column 2

This used to work fine in 2.0.11... (see attachment), any fix?

Yopu can just try to post below table code in a message here, same problem...
Code: [Select]
[table]
[tr][td]Member(s)[/td][/tr]
[tr][td][h r][b]Name[/b][hr][/td][td][hr][b]Nickname[/b][hr][/td][td][hr][b]City[/b][hr][/td][td][hr][b]Persons[/b][hr][/td][td][hr][b]Motorcycles[/b][hr][/td][/tr]
[tr][td]Member[/td][td]column 1[/td][td]column 2[/td][/tr]
[/table]
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: Antes on September 28, 2016, 09:00:26 AM
Unfortunately, I can't reproduce this issue on my localhost.

I can paste the code, then edit the post with both quick edit & normal edit.
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: @rjen on September 28, 2016, 09:35:39 AM
Grrr, I thought I nailed it, find attached a piece of code that WILL give the issue
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: Antes on September 28, 2016, 09:46:37 AM
Actually this also effects SMF 2.1.
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: Kindred on September 28, 2016, 09:48:32 AM
Deelnemer(s)

Naam


Forum naam


Woonplaats


Personen


Motoren

Martin Smitikke127Den Haag21
Martin WiegersM@rtinAmersfoort11
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: @rjen on September 28, 2016, 09:49:12 AM
Actually this also effects SMF 2.1.


Interesting, but it Does work in 2.0.11.

It seems it may not be the [h r] bbc code that causes it? But what does?
Can you tell me what exactly is the problem? Can I work around it somehow?
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: Kindred on September 28, 2016, 09:49:34 AM
Seems to work here....  ???
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: Antes on September 28, 2016, 09:51:06 AM
Seems to work here....  ???

Compare the code they are different.

Actually this also effects SMF 2.1.


Interesting, but it Does work in 2.0.11.

It seems it may not be the [h r] bbc code that causes it? But what does?
Can you tell me what exactly is the problem? Can I work around it somehow?

Are you sure SMF was not fixing the output in 2.0.11 ? (like trimming empty td tags etc...), which is what it does with the Kindred's post above.
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: @rjen on September 28, 2016, 09:52:18 AM
Did you try the code I posted?

What did you change?
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: Shambles on September 28, 2016, 10:34:38 AM
I'm guessing it doesn't like the look of the first unclosed [center] tag
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: Kindred on September 28, 2016, 10:41:41 AM
Deelnemer(s)

Naam

Forum naam

Woonplaats

Personen


Motoren

Martin Smitikke127Den Haag
2
1
Martin WiegersM@rtinAmersfoort
1
1

yup... closing all the center tags makes it work

Code: [Select]
[table]
[tr][td]Deelnemer(s)[/td][/tr]
[tr][td][hr][b]Naam[/b][hr][/td][td][hr][b]Forum naam[/b][hr][/td][td][hr][b]Woonplaats[/b][hr][/td][td][hr][center][b]Personen[/b][/center][hr][/td][td][hr][center][b]Motoren[/b][/center][hr][/td][/tr]
[tr][td]Martin Smit[/td][td]ikke127[/td][td]Den Haag[/td][td][center]2[/center][/td][td][center]1[/center][/td][/tr]
[tr][td]Martin Wiegers[/td][td]M@rtin[/td][td]Amersfoort[/td][td][center]1[/center][/td][td][center]1[/center][/td][/tr]
[/table]
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: @rjen on September 28, 2016, 10:46:47 AM
Deelnemer(s)

Naam

Forum naam

Woonplaats

Personen


Motoren

Martin Smitikke127Den Haag
2
1
Martin WiegersM@rtinAmersfoort
1
1

Looks like you are right. Now the question is: is this 'expected' behaviour?

Why does 2.0.12 all of a sudden consider this an issue? And more importantly: it may not be good form to not close these tags, but is the error:

Quote
The following error or errors occurred while posting this message:
The message body was left empty.

the correct response?  Let's put it this way: It will be hard to explain this behaviour to my users...  :-\
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: Antes on September 28, 2016, 11:07:32 AM
Its expected, but your code has invalid bbc usage (no closure for center tag). Try to post with fixing those center tags.
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: @rjen on September 28, 2016, 11:09:58 AM
Quote
Its expected, but your code has invalid bbc usage (no closure for center tag). Try to post with fixing those center tags.

I already did in my previous post, but that does not answer my question: the error does not explain what is wrong: users will NOT understand what they did wrong...


Actually this also effects SMF 2.1.

I just tested this in my SMF 2.1 beta 2 test forum: and it works fine there.
Are you referring to the beta 3 version?
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: Antes on September 28, 2016, 11:16:06 AM
Quote
Its expected, but your code has invalid bbc usage (no closure for center tag). Try to post with fixing those center tags.

I already did in my previous post, but that does not answer my question: the error does not explain what is wrong: users will NOT understand what they did wrong...


Actually this also effects SMF 2.1.

I just tested this in my SMF 2.1 beta 2 test forum: and it works fine there.
Are you referring to the beta 3 version?

Its not telling user which BBC breaking the post, its too techy for me if it should be (or it can be). If you are talking about fixed version yes, it shouldn't be creating error on SMF 2.1 as well.
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: @rjen on September 28, 2016, 11:23:40 AM
Quote
Its not telling user which BBC breaking the post,

Indeed, it is actually not telling the user that something is wrong with the bbc at all: it is telling the user the message text is missing, which they clearly see on their screen in front of them, so the next step is informing the administrator that they have an incorrect error message...

 :'(
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: @rjen on September 28, 2016, 01:04:22 PM
It's strange. I have been playing a bit with these tables, and the problem is fixed by just adding one character in the first line in one of the empty cells that have a [ center] div. No matter which... 
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: Kindred on September 28, 2016, 03:16:54 PM
probably....   empty BBC tags have been known to cause issues with the "no message body" error in some other cases...
(a message with nothing but an img BBC tag used to trigger exactly what error... so it is possible that this is related)

those center tags SHOULD be closed - otherwise it's not proper code anyway... :P
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: Suki on September 28, 2016, 07:00:51 PM
This should be the effect of not allowing empty BBC tags.

Unfortunately,  give a more accurate error response is somehow difficult,  the parser isn't actually checking for malformed BBC  tags but rather your BBC example is triggering the empty BBC check.
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: Brettflan on September 29, 2016, 12:33:42 AM
This problem popped up for our forum due to the 2.0.12 upgrade as well, and I can say that it's absolutely not just related to hr tags. I can provide another very specific example which triggers it for some reason. I've pared it down a bit from the example provided to me by a user.
"nobbc" tags are used below since they prevent the bug from triggering, where code tags don't.

This will result in a completely empty post ("Announcements" doesn't even appear, nor anything else you might also have in the post):

[center][table][tr][td][img]http://farm6.static.flickr.com/5188/5620582193_07207bc789_o.png[/img][/td][/tr][/table][/center]
[center][size=20pt][font=Arial]Announcements[/font][/size][/center]

Removing just the closing center tag from the top part lets it display:

[center][table][tr][td][img]http://farm6.static.flickr.com/5188/5620582193_07207bc789_o.png[/img][/td][/tr][/table]
[center][size=20pt][font=Arial]Announcements[/font][/size][/center]


Of course also removing the opening center tag on the second line would then leave it working and with valid opening and closing tags, but that's beside the point of there being a strange bug at work in the empty message detection.
Removing or changing most of the other tags also renders it as working, for example the size or font tags on the second line, or replacing the lone image in the top table with text.

There are other seemingly random instances where our users are running into the same problem with other BBCode layouts.
For now I've simply disabled this line of code which was added to Subs-Post.php by the 2.0.12 update, as a crappy workaround until a proper fix is available:
Code: [Select]
// Remove empty bbc.
$message = preg_replace('~\[([^\]=\s]+)[^\]]*\](?' . '>\s|(?R))*?\[/\1\]\s?~i', '', $message);
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: faresshajrii on October 01, 2016, 07:05:22 PM
Please guys fix it, this bug is really annoying us, at our forums we can't even update things.

I've tested this yesterday and I confirm it's from the table BBC.

Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: Kindred on October 01, 2016, 07:18:04 PM
this is not a bug. it is intentional and there is nothing to be fixed

correct your BBC and it will all be correct.

The reason you are seeing issues is because you are not entering correct/closed BBC tags
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: Brettflan on October 01, 2016, 08:38:53 PM
this is not a bug. it is intentional and there is nothing to be fixed

correct your BBC and it will all be correct.

The reason you are seeing issues is because you are not entering correct/closed BBC tags
Did you read my post above and test the provided example that triggers it? It should only take a few seconds.
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: faresshajrii on October 02, 2016, 06:54:34 AM
this is not a bug. it is intentional and there is nothing to be fixed

correct your BBC and it will all be correct.

The reason you are seeing issues is because you are not entering correct/closed BBC tags

Not really, we are entering a correct BBCodes, there is something that make the post invalid. Not only from our forums, people from other forums and use SMF 2.0.12 got this issue.
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: _Jojo_ on October 05, 2016, 04:04:12 PM
this is not a bug. it is intentional and there is nothing to be fixed

correct your BBC and it will all be correct.

The reason you are seeing issues is because you are not entering correct/closed BBC tags
Like the others say, this is a bug on multiple levels:

1. It rejects perfectly valid BBCode. Here's another example that breaks: http://pastebin.com/LmA1MbAJ I cannot post it on this forum because otherwise it will tell me the post is empty, hence I posted a link.

2. It doesn't tell the user. When your post just turns up empty, it's not your fault, it's the forum's fault. Especially if the forum doesn't tell you why.

That being said, this kind of problem really should not be solved with regular expressions.
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: _Jojo_ on October 06, 2016, 07:35:02 AM
And here's an even more minimal test case: http://pastebin.com/f8wHXK8D
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: Suki on October 06, 2016, 11:49:42 AM
this is not a bug. it is intentional and there is nothing to be fixed

correct your BBC and it will all be correct.

The reason you are seeing issues is because you are not entering correct/closed BBC tags
Like the others say, this is a bug on multiple levels:

1. It rejects perfectly valid BBCode. Here's another example that breaks: http://pastebin.com/LmA1MbAJ I cannot post it on this forum because otherwise it will tell me the post is empty, hence I posted a link.

2. It doesn't tell the user. When your post just turns up empty, it's not your fault, it's the forum's fault. Especially if the forum doesn't tell you why.

That being said, this kind of problem really should not be solved with regular expressions.

Yes, it is a bug, an incidental one but a bug in the end.

The problem you're facing is a derivative from another one (prevent empty BBC codes). The regex used doesn't caught several BBC formats already posted here, the code's logic dictates to remove the failed test, which result in an empty post and thus the "your message is empty" message appear.

The empty message problem shouldn't be dealt with regex, thats for sure, but the empty BBC tags (the original issue) does.

We cannot change our current BBC parser to another more robust solution like a string tokenizer, therefore, regex and/or a combination of php logic plus regex is what we are going to use.

If you would like to help us, please keep posting valid BBC formats that breaks the current regex, that way we have more options to test our patch against.
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: Raffaele1977 on October 07, 2016, 06:52:29 AM
Is a solution to use html blocks?
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: Suki on October 07, 2016, 09:01:01 AM
That would only work for admins I'm afraid.
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: Raffaele1977 on October 09, 2016, 10:01:28 AM
I discovered (for my case) that the problem appears every time i use the center bbc code.

Sometimes i insert a (alt+space) character after the closed center tag and it works.
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: seydon on October 12, 2016, 09:50:11 PM
Here is another example of bbcode that gives me the "empty message"... This is tested to be working great in SMF 2.0.11... I installed a fresh SMF in a test subdomain (2.0.11), created a new post with this bbcode and it worked. Installed the 2.0.12 patch and cannot post this anymore... (using the nobbc since the bbcode "code" doesn't work, as seen in this example...

If I remove the part enclosed in "code", it works... If I add a . (a simple dot) between the code bbcode and the bold, it also works...


[center][font=courier][size=18pt][glow=yellow,2,300]Thread Header[/glow][/size][/font][/center][hr]
[b][font=papyrus][size=18pt][color=darkkhaki]When: [/color][/size][/font][/b]
[b][font=papyrus][size=18pt][color=darkkhaki]Where: [/color][/size][/font][/b]   
[hr]

[code]
[b][size=18pt][font=papyrus][color=darkkhaki]When: [/color][/font][/size][/b]
[b][size=18pt][font=papyrus][color=darkkhaki]Where: [/color][/font][/size][/b]
[hr]
[/code]
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: seydon on October 12, 2016, 09:55:52 PM
a simpler version of the same code that fails (still between nobbc). Again, adding a simple . character at some locations (for example, before the first bold tag in both sections solves the issue...


[center][font=courier][size=18pt][glow=yellow,2,300]Thread Header[/glow][/size][/font][/center][hr]
[font=papyrus][size=18pt][color=darkkhaki][b]When: [/b]
[b]Where: [/b]  [/color][/size][/font] 
[hr]

[code]
[size=18pt][font=papyrus][color=darkkhaki][b]When: [/b]
[b]Where: [/b][/color][/font][/size]
[hr]
[/code]
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: SMiFFER on October 13, 2016, 01:35:10 AM
I already did in my previous post, but that does not answer my question: the error does not explain what is wrong: users will NOT understand what they did wrong...
Exactly. This error-message is absolutely misleading and therefore bad - no matter where it comes from.

It is the result what counts.

Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: neosymmetrical on October 13, 2016, 02:32:10 AM
My roleplay forum is having issues as well, I assumed this was due ot the "BBC With style" mod but all of these bugs seem to be appearing on my forum as well, one of my admins is testing this out with several different codes in order to figure out whats causing it as well, if needed we can provide what we found as well.
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: The Lurker on October 15, 2016, 09:29:47 AM
I have noticed the issue when trying to post text that includes square brackets in a table.

A very stripped down example is here (https://paste.ee/p/p4FB9), because I cannot post it, even inside [nobbc] or [code] tags.

Please fix it.


Edit: image.

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.simplemachines.org%2Fcommunity%2Findex.php%3Faction%3Ddlattach%3Btopic%3D549271.0%3Battach%3D250053%3Bimage&hash=7fa5b3c239da45f08b8aa7a80761e66a)
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: BaileyD on October 15, 2016, 07:12:50 PM
[center][color=orange][size=18pt][font=georgia]Yes[/font][/size][/color][/center]
[center][color=green][size=14pt][font=georgia]No[/font][/size][/color][/center]

I created a support topic about this but I expect that having all of these combinations in one topic will help. The above runs in to the issue with no tables or anything. There's no broken tags as far as I can see either.
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: lurkalot on October 16, 2016, 05:16:30 AM
[center][color=orange][size=18pt][font=georgia]Yes[/font][/size][/color][/center]
[center][color=green][size=14pt][font=georgia]No[/font][/size][/color][/center]

I created a support topic about this but I expect that having all of these combinations in one topic will help. The above runs in to the issue with no tables or anything. There's no broken tags as far as I can see either.

Confirmed.  Strange though, because if you remove the closing center tags in this case it works.

[center][color=orange][size=18pt][font=georgia]Yes[/font][/size][/color]
[center][color=green][size=14pt][font=georgia]No[/font][/size][/color]

Yes
No
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: SevenUp on October 28, 2016, 04:46:48 AM
If you would like to help us, please keep posting valid BBC formats that breaks the current regex, that way we have more options to test our patch against.

Happy to help, if only in a limited way.  The code below
[table]
[tr][td]R1C1[/td][td]R1C2[/td][td]R1C3[/td][/tr]
[tr][td]R2C1[/td][td]        [/td][td]R2C3[/td][/tr]
[tr][td]R3C1[/td][td]R3C2[/td][td]R3C3[/td][/tr]
[/table]

now displays, instead of the expected blank middle cell,
R1C1R1C2R1C3
R2C1R2C3
R3C1R3C2R3C3

and removes the
[td]        [/td]
that was entered in the second table row.

Appreciate your efforts to restore proper table formatting.
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: Vincenz0 on November 02, 2016, 06:34:48 AM
So the problem is this:
With the latest patch you guys added the following code to the Subs-Post.php file:

Code: [Select]
// Remove empty bbc.
$message = preg_replace('~\[([^\]=\s]+)[^\]]*\](?' . '>\s|(?R))*?\[/\1\]\s?~i', '', $message);

My preg knowledge is not enough to know what exactly this does but it is creating problems for us.

If a user uses too many BBC codes or something the whole message gets truncated into nothing and they get an error that the message body is empty, also when clicking Preview, the preview would be empty.

For my forum I just commented out this whole line and it solved our problems.
Any idea what is going on?

Here is a test code to reproduce it:
http: // paste . ubuntu . com/23415521/
(remove spaces)

I tried adding the above code in a CODE bracket on this forum but it gave me the same error:
(https://i.imgur.com/8tmb5I3.png)
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: Kindred on November 02, 2016, 07:43:25 AM
yes... we know (did you read the whole thread?).
We are working on a fix.
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: NekoSensei on November 11, 2016, 05:11:19 PM
I have to uninstall the patch 2.0.12 because of the same error, I can not edit my old posts on the forum and create new... it's a shame, I'm waiting for the patch of this patch :)
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: SMiFFER on November 12, 2016, 11:55:50 PM
True. And I wonder what takes so long to release a fix for this - this bug has been reported 2 months ago.

If some certain heroes would invest the time they put into cheeky and snarky remarks rather into this fix, it would long be done.
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: Illori on November 13, 2016, 06:09:21 AM
this fix is not as easy as some may think it is. when it is confirmed that it has been fixed and fixed correctly the team will release the next patch. do remember not everyone on the team works on making the patches, we all have our own tasks and abilities.
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: whoey on November 20, 2016, 07:35:15 AM
found this thread as pointed out by oddguy here: http://www.simplemachines.org/community/index.php?topic=548926

This also applies to multilevel nested quotes.
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: SMiFFER on November 20, 2016, 12:14:44 PM
I have to uninstall the patch 2.0.12 because of the same error, I can not edit my old posts on the forum and create new... it's a shame, I'm waiting for the patch of this patch :)
Full ACK!
This is the most nerve-cutting thing with this bug: It used to work before and existing posts cannot be changed unless you work through every detail (which was NOT (!) needed prior to 2.0.12)

When is the fix coming? Any date known yet?
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: d3vcho(); on November 20, 2016, 12:51:35 PM
Hello!

Soon, we all hope, but we don't have any official information yet. According to this post (http://www.simplemachines.org/community/index.php?topic=548881.msg3899851#msg3899851), 2.0.13 is currently being tested.

Regards :)
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: Kindred on November 20, 2016, 04:29:32 PM
and you should know that we NEVER promise dates.
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: adroth92 on November 21, 2016, 01:51:20 PM
Sorry if this should be posted elsewhere, but is anyone aware of any problems with downgrading to 2.0.11 while waiting for this update?
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: d3vcho(); on November 21, 2016, 01:52:38 PM
There shouldn't be any problems. Just in case, before downgrading, make a backup of your whole forum.

Regards :)
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: SMiFFER on November 24, 2016, 03:03:07 PM
Hello!

Soon, we all hope, but we don't have any official information yet. According to this post (http://www.simplemachines.org/community/index.php?topic=548881.msg3899851#msg3899851), 2.0.13 is currently being tested.

Regards :)

Nice!
Now let them work...
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: TheBiggerFish on December 06, 2016, 03:30:05 PM
This bug does NOT occur inside [nobbc] tags.  So it's definitely somewhere in the BBCode functions.

[table]
[tr]
[td][quote][/quote][/td]
[/tr]
[/table]
[table]
[tr]
[td][b][/b][/td]
[/tr]
[/table]

Testing if it's just the open tag...

[table]
[tr]
[td][b]recreated format with just the open tag[/td]
[/tr]
[/table]

So if you only have an open tag in the second table, the second table survives, but not the first.

Testing with only open tags in both tables...
[table]
[tr]
[td][quote][/td]
[/tr]
[/table]
[table]
[tr]
[td][b][/td]
[/tr]
[/table]

Well, three tables with only open tags makes it yell at me.

Two open tags only also breaks it.

Testing mismatched open/close...


[table]
[tr]
[td][quote][/quote][/td]
[/tr]
[/table]
[table]
[tr]
[td][b][i][/b][/td]
[/tr]
[/table]
It preserves the second table but eats the first again.

Testing double mismatching...
[table]
[tr]
[td][quote][b][/quote][/td]
[/tr]
[/table]
[table]
[tr]
[td][b][i][/b][/td]
[/tr]
[/table]
Doesn't work.
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: TheBiggerFish on December 06, 2016, 04:16:22 PM
So the problem is this:
With the latest patch you guys added the following code to the Subs-Post.php file:

Code: [Select]
// Remove empty bbc.
$message = preg_replace('~\[([^\]=\s]+)[^\]]*\](?' . '>\s|(?R))*?\[/\1\]\s?~i', '', $message);

My preg knowledge is not enough to know what exactly this does but it is creating problems for us.

If a user uses too many BBC codes or something the whole message gets truncated into nothing and they get an error that the message body is empty, also when clicking Preview, the preview would be empty.

For my forum I just commented out this whole line and it solved our problems.
Any idea what is going on?

Here is a test code to reproduce it:
http: // paste . ubuntu . com/23415521/
(remove spaces)

I tried adding the above code in a CODE bracket on this forum but it gave me the same error:
(https://i.imgur.com/8tmb5I3.png)
yes... we know (did you read the whole thread?).
We are working on a fix.
...Is this removing BBCode from the post itself?  Why is it even doing that...?

E: ...carp.  Sorry about doubleposting (please don't hurt me)
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: TheBiggerFish on December 07, 2016, 12:31:14 AM
Well the edit button disappeared, that is a thing and it is very annoying.

Found another breaking expression:
[color=lightblue][i][Any text in brackets]   [/i][/color]

It leaves behind the open tags up to italics, and the closing color tag.
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: neogodless on December 08, 2016, 09:14:11 AM
Table 1
Row 1
Row 2
Table 2
Row 1

Hmm, what version is THIS forum running on? The following code does not work on our forum:

[table][tr][td][right][b]Table 1[/b][/right][/td][/tr][tr][td]Row 1[/td][/tr][tr][td][right][b]Row 2[/b][/right][/td][/tr][/table]
[table][tr][td][right][b]Table 2[/b][/right][/td][/tr][tr][td]Row 1[/td][/tr][/table]


The key seems to be [b] tags on subsequent rows (you can have them in the first row), and having a second table tag. But note that there are no open tags!
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: TheBiggerFish on December 08, 2016, 12:51:19 PM
This forum?  It's running 2.0.12.

Yours should say if you scroll down to the bottom of the page, and there are apparently admin tools to check your version if you doubt that.
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: TheBiggerFish on December 17, 2016, 04:24:41 AM
Got another one:

[quote]
[quote]
[any text]
[/quote]
[/quote]
[any text]
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: TheBiggerFish on December 20, 2016, 03:36:27 PM
*I would edit to clarify but cannot: The brackets around [any text] are actually there in the post.
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: Antes on December 20, 2016, 03:38:28 PM
You should attach the problematic BBC combination as txt file here. We already have a patch on testing lane so we can run your combination and return the result.
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: TheBiggerFish on December 29, 2016, 05:34:13 PM
Apparently

[quote][/quote]
bugs out too.

It eats up to one trailing linebreak, judging from posting it here.  (Someone else ran across the bug, I'm just crossposting.)
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: Kindred on December 29, 2016, 07:07:47 PM
and empty quote is invalid anyway
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: TheBiggerFish on January 04, 2017, 02:56:48 PM
.
Empty quote with attributes is not invalid, though, right?  Because I mean a lot of people use that.

Got another one:

[img width=100]image[/img]
[quote author=authorname link=topic=144549.msg6597134#msg6597134 date=1446937214]
[center][color=magenta][size=14pt][glow=purple,2,300][b]text[/b][/glow][/size][/color][/center]
[/quote]
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: Kindred on January 04, 2017, 03:10:55 PM
any empty quote is invalid, IMO....   I have never seen anyone use a quote box, even with attributes, without having textual content IN the quote....
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: Antes on January 06, 2017, 09:34:39 PM
Please test the issue again in SMF 2.0.13 if you are having issue open a new topic with [SMF 2.0.13] tag on topic.

Thank you.
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: TheBiggerFish on January 07, 2017, 12:40:04 AM
any empty quote is invalid, IMO....   I have never seen anyone use a quote box, even with attributes, without having textual content IN the quote....
I have.
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: adroth92 on January 09, 2017, 03:15:57 AM
Please test the issue again in SMF 2.0.13 if you are having issue open a new topic with [SMF 2.0.13] tag on topic.

Thank you.

Problem fixed!!!!

Thank you SMF team.
Title: Re: [2.0.12] Cannot post tables in messages anymore due to [h r] in table
Post by: SevenUp on January 21, 2017, 04:49:22 PM
Please test the issue again in SMF 2.0.13 if you are having issue open a new topic with [SMF 2.0.13] tag on topic.

Thank you.
Fixed.  Thank you!