Table BBCode broken after upgrade to 3.2.1

Get help with installation and running phpBB 3.2.x here. Please do not post bug reports, feature requests, or extension related questions here.
Post Reply
User avatar
Electrix
Registered User
Posts: 41
Joined: Mon Apr 13, 2015 10:21 am
Location: Czech Republic

Table BBCode broken after upgrade to 3.2.1

Post by Electrix »

Hi. Today I have upgraded my board from phpBB 3.1.10 to 3.2.1 and now I have troubles with table BBCode. Initially, I have posted this in another similar thread, but I was advised by a mod to start a new topic. So here it comes.

Previously (on 3.1.10) I was using these definitions:

Code: Select all

[table]{TEXT}[/table]
<table>{TEXT}</table>

[table=center]{TEXT}[/table]
<table class="center">{TEXT}</table>

[tr]{TEXT}[/tr]
<tr>{TEXT}</tr>

[th]{TEXT}[/th]
<th>{TEXT}</th>

[td]{TEXT}[/td]
<td>{TEXT}</td>

[th={NUMBER1},{NUMBER2}]{TEXT}[/th]
<th colspan="{NUMBER1}" rowspan="{NUMBER2}">{TEXT}</th>

[td={NUMBER1},{NUMBER2}]{TEXT}[/td]
<td colspan="{NUMBER1}" rowspan="{NUMBER2}">{TEXT}</td>
Unfortunately, after upgrade to phpBB 3.2.1 all these BBCodes (except [table] itself) stopped working and started showing as plain text (on newly submitted posts). After some testing I have found out that renaming those "overloaded" cell tags (th=, td=) to something else (for ex. thc=, tdc=) solves the problem.

So far so good. Unfortunately, I have noticed that when I do so, all OLD posts, that contain this BBCode tag, become broken (again, BBCode is shown as plain text). The board is very large, so manually editing all affected posts is out of question.

Software used on web server (shouldn't matter, just for the sake of completness):
  • PHP 5.4.44
  • MySQL 5.6.26
  • NGINX 1.13.6
Do you guys have any other ideas aside from going back to 3.1.10? Thank you very much for help.
„Only a life lived for others is a life worthwhile.“[A. Einstein]
User avatar
JoshyPHP
Code Contributor
Posts: 1288
Joined: Mon Jul 11, 2011 12:28 am

Re: Table BBCode broken after upgrade to 3.2.1

Post by JoshyPHP »

There's a known issue with BBCodes sharing the same name. You'll need to create a single BBCode and mark the attributes as optional. There's some doc there.

Code: Select all

[th={NUMBER1},{NUMBER2} colspan={NUMBER1;optional} rowspan={NUMBER2;optional}]{TEXT}[/th]
<th><xsl:copy-of select="@colspan"/><xsl:copy-of select="@rowspan"/>{TEXT}</th>

[td={NUMBER1},{NUMBER2} colspan={NUMBER1;optional} rowspan={NUMBER2;optional}]{TEXT}[/td]
<td><xsl:copy-of select="@colspan"/><xsl:copy-of select="@rowspan"/>{TEXT}</td>
If you want to reparse old posts without manually editing them you'll have to use the CLI reparser. I think the correct invocation is this:

Code: Select all

bin/phpbbcli.php reparser:reparse post_text
Last edited by JoshyPHP on Thu Oct 12, 2017 2:41 pm, edited 1 time in total.
I wrote the library that handles markup in phpBB 3.2+.
User avatar
Electrix
Registered User
Posts: 41
Joined: Mon Apr 13, 2015 10:21 am
Location: Czech Republic

Re: Table BBCode broken after upgrade to 3.2.1

Post by Electrix »

Thank you very much JoshyPHP, your BBCode templates worked great. I only had a minor troubles with reparser - it got stuck on first run (at about 23k/1.2M), but restarting php service and resuming reparsing process solved it (via --resume option).

I also used following command to reparse user signatures with tables:

Code: Select all

bin/phpbbcli.php reparser:reparse user_signature
For future visitors: examples can be found here.

Right now, everything seems to work fine. Thanks again! :)
„Only a life lived for others is a life worthwhile.“[A. Einstein]
User avatar
rht
Registered User
Posts: 2
Joined: Thu Sep 28, 2017 4:20 pm
Location: UK

Re: Table BBCode broken after upgrade to 3.2.1

Post by rht »

Have been hunting for a fix for broken custom table BBCodes for a while and stumbled on this. Very helpful, thank you. I have changed my BBCodes to use optional attributes and now have a single BBCode entry for each element - and tables are working again! :mrgreen:

Many Thanks R.
CentOS 7.2 / PHP 5.4 / MariaDB 5.5
Post Reply

Return to “[3.2.x] Support Forum”