Search user posts BBCode not always parsed which can misattribute quoted material

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
P_I
Registered User
Posts: 1228
Joined: Tue Mar 01, 2011 8:35 pm
Location: Staying home - Calgary
Contact:

Search user posts BBCode not always parsed which can misattribute quoted material

Post by P_I »

When someone clicks on the number of posts shown in the members profile, the output shows the first 300 characters with a 'Jump to post' link.

There seems to be an inconsistency how posts that contain BBCodes are handled in the output. Looking at my posts for example, search.php?author_id=1314447&sr=posts. I've attached a screenshot:
phpBB - search user posts.JPG
Any BBCodes in the first 6 posts shown are properly processed, so quoted text and URLs are properly displayed. But look at the last one in the screenshot. The BBCodes are NOT processed.

In my viewpoint this is particularly problematic when a post starts with a quote. A live example I've found that demonstrates this is search.php?author_id=1431526&sr=posts,
phpBB - search user posts BBCode not processed.JPG
makes it appear that Bruce Banner posted the text "Too many connections. That is very clear I think, look in "who is online" from who that connections are and block them id possible. If the all are logged in users than you have to ask your host how to increase the max. connections What I don't understand is that could be causing the first general e..."

But clicking Jump to post shows
phpBB - search user posts BBCode not processed, actual post.JPG
shows that Bruce Banner only posted the text "What I don't understand is that could be causing the first general error message I mentioned but what about the other two?" and the rest of the text was quoted material for other users.

Is this a bug or just an undocumented feature? Because it is confusing members on one of my boards.
Normal people… believe that if it ain’t broke, don’t fix it. Engineers believe that if it ain’t broke, it doesn’t have enough features yet. – Scott Adams
User avatar
EA117
Registered User
Posts: 1805
Joined: Wed Aug 15, 2018 3:23 am
Contact:

Re: Search user posts BBCode not always parsed which can misattribute quoted material

Post by EA117 »

I don't know the definite answer of "what may have been intended for the search results display", but I expect (as you may already expect too) that the behavior stems from the "&ch=" option. i.e. How much of a matching post should be displayed; 100 characters? 300 characters? 900 characters? The entire message?

Where ever that cut-off lands, you're potentially "in the middle of one or more open BBCodes." Whether that's a quote, a code block, URL or other formatting, etc. I didn't go spelunking through the search code, but I assume the fact we're not seeing an abandoned opening [quote] code in the output means that search actually does go out of it's way to "remove any BBCodes which aren't going to display correctly due to the message having been cut-off mid-sentence."

I would guess that it should be possible, though perhaps just more code to write, to "close all outstanding codes when the cut-off happens" rather than stripping them out. But again, I don't know the true intention or the technical challenge in doing that. But going and looking at any notes in the code that helps prepare the search results for display might reveal some additional clues or information.
User avatar
P_I
Registered User
Posts: 1228
Joined: Tue Mar 01, 2011 8:35 pm
Location: Staying home - Calgary
Contact:

Re: Search user posts BBCode not always parsed which can misattribute quoted material

Post by P_I »

The use case that triggered this is board members looking to bookmark and easily find the most recent posters from their 'favorite' members. The short answer we've provided is bookmark something like EA117's posts.

Code: Select all

https://www.phpbb.com/community/search.php?author_id=1843121&sr=posts
The behaviour that is confusing board members is some of the results return without the BBCode parsed, which in the case of quoted replies misrepresents who posted what. The inconsistency of sometimes BBCodes are parsed and sometimes not is the fundamental issue here.

As you've mentioned here and in other posts, it is possible to play with some of the other search.php parameters to refine this and that has proven helpful, i.e to display the whole post in the search results add the &ch=-1 parameter.

I've also created [PHPBB3-16426] Search settings should allow specification of number of characters to return - phpBB Tracker so that the current hardcoded 300 characters to be returned can be changed via ACP->Search settings.
Normal people… believe that if it ain’t broke, don’t fix it. Engineers believe that if it ain’t broke, it doesn’t have enough features yet. – Scott Adams
User avatar
EA117
Registered User
Posts: 1805
Joined: Wed Aug 15, 2018 3:23 am
Contact:

Re: Search user posts BBCode not always parsed which can misattribute quoted material

Post by EA117 »

P_I wrote:
Mon Apr 06, 2020 3:24 pm
I've also created [PHPBB3-16426] Search settings should allow specification of number of characters to return - phpBB Tracker so that the current hardcoded 300 characters to be returned can be changed via ACP->Search settings.
That sounds like a potentially useful preference for the phpBB operator to assert. Maybe a UCP option would suit some uses cases too; e.g. someone who doesn't mind seeing the whole message by default every time might want that behavior, even if its not the board default.

Looking through search.php, they're actually checking whether "one or more BBCodes were used" and invoke a strip_bbcode() helper to create a "text-only version of the message." It's then the length measurement of this text-only version which is used to decide "are we under the &ch= option limit or not." If the message needs to be truncated, a truncated version of the text-only version is what's being shown. Which is why "all BBCodes are absent", and not just "the ones which were hanging open at the point of truncation" like I had theorized.

So the output definitely will be very basic, and will not attribute quotes or differentiate between code blocks or any other BBCodes. Because it's explicitly and intentionally displaying a "plain-text" version of the message when truncated.
User avatar
P_I
Registered User
Posts: 1228
Joined: Tue Mar 01, 2011 8:35 pm
Location: Staying home - Calgary
Contact:

Re: Search user posts BBCode not always parsed which can misattribute quoted material

Post by P_I »

EA117 wrote:
Mon Apr 06, 2020 3:38 pm
P_I wrote:
Mon Apr 06, 2020 3:24 pm
I've also created [PHPBB3-16426] Search settings should allow specification of number of characters to return - phpBB Tracker so that the current hardcoded 300 characters to be returned can be changed via ACP->Search settings.
That sounds like a potentially useful preference for the phpBB operator to assert. Maybe a UCP option would suit some uses cases too; e.g. someone who doesn't mind seeing the whole message by default every time might want that behavior, even if its not the board default.
Good improvement.
EA117 wrote:
Mon Apr 06, 2020 3:38 pm
Looking through search.php, they're actually checking whether "one or more BBCodes were used" and invoke a strip_bbcode() helper to create a "text-only version of the message." It's then the length measurement of this text-only version which is used to decide "are we under the &ch= option limit or not." If the message needs to be truncated, a truncated version of the text-only version is what's being shown. Which is why "all BBCodes are absent", and not just "the ones which were hanging open at the point of truncation" like I had theorized.

So the output definitely will be very basic, and will not attribute quotes or differentiate between code blocks or any other BBCodes. Because it's explicitly and intentionally displaying a "plain-text" version of the message when truncated.
I've been looking too and trying to figure it out and therefore how to recommend something to my membership. Thanks for doing my homework. Much appreciated.
Normal people… believe that if it ain’t broke, don’t fix it. Engineers believe that if it ain’t broke, it doesn’t have enough features yet. – Scott Adams
User avatar
P_I
Registered User
Posts: 1228
Joined: Tue Mar 01, 2011 8:35 pm
Location: Staying home - Calgary
Contact:

Re: Search user posts BBCode not always parsed which can misattribute quoted material

Post by P_I »

Normal people… believe that if it ain’t broke, don’t fix it. Engineers believe that if it ain’t broke, it doesn’t have enough features yet. – Scott Adams
Post Reply

Return to “[3.2.x] Support Forum”