[2.0.12] Cannot post tables in messages anymore due to [h r] in table

Started by @rjen, September 28, 2016, 08:28:45 AM

Previous topic - Next topic

@rjen

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:

QuoteThe 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...

[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]
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

Antes

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.

@rjen

Grrr, I thought I nailed it, find attached a piece of code that WILL give the issue
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

Antes


Kindred


Deelnemer(s)


Naam



Forum naam



Woonplaats



Personen



Motoren

Martin Smitikke127Den Haag21
Martin WiegersM@rtinAmersfoort11
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

@rjen

Quote from: Antes on September 28, 2016, 09:46:37 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?
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

Kindred

Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Antes

Quote from: Kindred on September 28, 2016, 09:49:34 AM
Seems to work here....  ???

Compare the code they are different.

Quote from: @rjen on September 28, 2016, 09:49:12 AM
Quote from: Antes on September 28, 2016, 09:46:37 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?

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.

@rjen

Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

Shambles

I'm guessing it doesn't like the look of the first unclosed [center] tag

Kindred


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


[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]
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

@rjen


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:

QuoteThe 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...  :-\
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

Antes

Its expected, but your code has invalid bbc usage (no closure for center tag). Try to post with fixing those center tags.

@rjen

QuoteIts 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...


Quote from: Antes on September 28, 2016, 09:46:37 AM
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?
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

Antes

Quote from: @rjen on September 28, 2016, 11:09:58 AM
QuoteIts 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...


Quote from: Antes on September 28, 2016, 09:46:37 AM
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.

@rjen

QuoteIts 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...

:'(
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

@rjen

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... 
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

Kindred

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
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Suki

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.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Brettflan

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:
// Remove empty bbc.
$message = preg_replace('~\[([^\]=\s]+)[^\]]*\](?' . '>\s|(?R))*?\[/\1\]\s?~i', '', $message);

Advertisement: