Old Posts Stuck with Unparsed BBCode

Get help with installation and running phpBB 3.3.x here. Please do not post bug reports, feature requests, or extension related questions here.
stubby13
Registered User
Posts: 4
Joined: Fri Sep 27, 2024 5:06 pm

Old Posts Stuck with Unparsed BBCode

Post by stubby13 »

Hi all,

I have a "client" that recently asked me to upgrade their phpBB system from 3.1.11 to 3.3.13. I had no issues with the upgrade and have been pretty impressed with the phpBB software. However, I'm noticing some existing posts have unparsed BBcode in them and I cannot seem to figure out how to reliably fix these posts.

Some background:
My client has been using phpBB for a long time. I think they said the database is almost 20 years old. They have had several major upgrades along the way mostly without issue.

Some time ago, the hosting company that (at the time) maintained the site forced them to upgrade I believe to 3.1.11 from 2.x. The hosting company performed the upgrade and introduced a lot of errors and unwanted behaviors on the site. I do not know what they did or what was specifically broken. One of the things that was broken is that BBcode was no longer parsed in new posts. The site ran this way for months before my client contacted me.

I performed a "clean" upgrade to 3.3.13 which removed all the errors and fixed the BBcode issues for new posts. I've tried several things in a test environment to reparse the posts which have unparsed BBCode.

I've run the phpBBcli tool with the reparse option with no luck. I was able to focus on a single post and verified that the phpBBcli tool does modify that record. However, it does not parse the BBCode. The only thing from the database that I was able to notice is that the text for the post is surrounded by "T" XML tags in this post while correctly parsed posts have the text surrounded in "R" tags.

I've tried running a PHP script I found online that, I believe, edits all the posts. However, this did not completely work as nginx threw a 504 gateway timeout error during the script run. This also creates enormous numbers of notifications about the edited posts. I do not have enough PHP dev skills to hack at that script.

I would love any information or suggestions to resolve this.

Thanks for help
User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 6296
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.

Re: Old Posts Stuck with Unparsed BBCode

Post by thecoalman »

This should go without saying but backup DB first You can reparse all posts using phpBB's CLI.

https://www.phpbb.com/support/docs/en/3 ... -reparser/

If that does not solve your problem then copy full text of a problematic post from DB and post here in the code tags.
“Results! Why, man, I have gotten a lot of results! I have found several thousand things that won’t work.”

Attributed - Thomas Edison
stubby13
Registered User
Posts: 4
Joined: Fri Sep 27, 2024 5:06 pm

Re: Old Posts Stuck with Unparsed BBCode

Post by stubby13 »

Thanks so much for your time.
thecoalman wrote: Fri Sep 27, 2024 6:26 pm This should go without saying but backup DB first You can reparse all posts using phpBB's CLI.
Thanks for the warning. I have DB backups galore and can even recreate the old broken system if necessary.
thecoalman wrote: Fri Sep 27, 2024 6:26 pm https://www.phpbb.com/support/docs/en/3 ... -reparser/

If that does not solve your problem then copy full text of a problematic post from DB and post here in the code tags.
I've successfully ran the reparser with and without the --safe-mode option.

Here is the text from the DB for a known problem post:

Code: Select all

<t>[quote="ElectricSheep"]https://www.oldlinegarrison.com/phpBB3/viewtopic.php?f=84&amp;t=12140<br/>
<br/>
This thread is wonky and a priority to fix![/quote]<br/>
<br/>
That is the same error I was seeing on other posts.</t>
User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 6296
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.

Re: Old Posts Stuck with Unparsed BBCode

Post by thecoalman »

For that post is the column enable_bbcode 1?
“Results! Why, man, I have gotten a lot of results! I have found several thousand things that won’t work.”

Attributed - Thomas Edison
stubby13
Registered User
Posts: 4
Joined: Fri Sep 27, 2024 5:06 pm

Re: Old Posts Stuck with Unparsed BBCode

Post by stubby13 »

thecoalman wrote: Fri Sep 27, 2024 7:59 pm For that post is the column enable_bbcode 1?
Yes it is.
rxu
Extensions Development Team
Posts: 3900
Joined: Wed Oct 25, 2006 12:46 pm
Location: Siberia, Russian Federation

Re: Old Posts Stuck with Unparsed BBCode

Post by rxu »

it looks that the text matches neither phpBB 2.0 nor 3.3 parsed BBCode format. Former would look something like

Code: Select all

[quote="ElectricSheep"]https://www.oldlinegarrison.com/phpBB3/viewtopic.php?f=84&amp;t=12140<br/>
<br/>
This thread is wonky and a priority to fix![/quote:q6n6xsd]
<br/>
That is the same error I was seeing on other posts.
(where :q6n6xsd is some example value from bbcode_uid field) and the latter would look something like

Code: Select all

<r><QUOTE author="ElectricSheep"><s>[quote="ElectricSheep"]</s><URL url="https://www.oldlinegarrison.com/phpBB3/viewtopic.php?f=84&amp;amp;t=12140"><LINK_TEXT text="https://www.oldlinegarrison.com/phpBB3/ ... mp;t=12140">https://www.oldlinegarrison.com/phpBB3/viewtopic.php?f=84&amp;amp;t=12140</LINK_TEXT></URL><br/>
<br/>
<br/>
This thread is wonky and a priority to fix!<e>[/quote]</e></QUOTE>

<br/>
That is the same error I was seeing on other posts.</r>
Hence reparser treats this as a plain text with no BBCode (as it can't find phpBB 2.0 or 3.3 parsed BBCodes in the text). As far as the reparser has no options to enforce parsing plain text as BBCode to get them back to the text again, it seems there's no easy way to fix that.
User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 6296
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.

Re: Old Posts Stuck with Unparsed BBCode

Post by thecoalman »

Appears you are in no where land. You can manually edit them to fix it, how many do you have?

Code: Select all

SELECT * FROM `phpbb_posts` WHERE `enable_bbcode` = 1 AND `post_text` LIKE '%[q%' AND `post_text` LIKE '%<t>%' ; 
It's only for the quotes, there will be others. That's also going to find broken bb codes and possibly some other stuff. I have over 600 myself but they are all broken bbcodes because of how they were submitted, e.g user removed end tag. It's easy to get the post ID's into a html document so you can easily go right to them if that is option.
“Results! Why, man, I have gotten a lot of results! I have found several thousand things that won’t work.”

Attributed - Thomas Edison
stubby13
Registered User
Posts: 4
Joined: Fri Sep 27, 2024 5:06 pm

Re: Old Posts Stuck with Unparsed BBCode

Post by stubby13 »

thecoalman wrote: Sat Sep 28, 2024 10:13 am Appears you are in no where land. You can manually edit them to fix it, how many do you have?
Thanks a ton for your help this far. I've had a long conversation with them about this already and they are willing to accept that stuff was just broken for a while and this is the result. Your query pulled back about 50 records of which I'd guess 80% of them are "broken" posts. Several are just formatting errors like missing closing tags in the BBcode.

Thanks again. If you need to mark this post closed please do so.
User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 6296
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.

Re: Old Posts Stuck with Unparsed BBCode

Post by thecoalman »

If it's just 50 of them you can export just the post ID's.

Code: Select all

SELECT post_id FROM `phpbb_posts` WHERE `enable_bbcode` = 1 AND `post_text` LIKE '%[q%' AND `post_text` LIKE '%<t>%' ; 
At the bottom of results select the export button, switch to CSV and custom, remove the options for columns. That will give you the ID's on new lines. You can even import into editor and add example.com/viewtopic.php?p= at start of new line. Post into forum and they have links to all of them. :D

There is probably others with other bbcode broken.
“Results! Why, man, I have gotten a lot of results! I have found several thousand things that won’t work.”

Attributed - Thomas Edison
wintstar
Registered User
Posts: 334
Joined: Sat Mar 07, 2009 12:39 pm
Location: Central Hessen, close to the "heart of nature", Germany

Re: Old Posts Stuck with Unparsed BBCode

Post by wintstar »

Sourcecode of BBcode phpBB 2.0-0

You can also look at other phpBB versions to see what kind of BBCode it could be.

Return to “[3.3.x] Support Forum”