Kunena 7.0.6 & Kunena 6.4.12 – Security Updates Released

The Kunena team has announce the arrival of Kunena 7.0.6 [K 7.0.6] in stable which is now available for download as a native Joomla extension for J! 5.4.x/6.0.x. This version addresses most of the issues that were discovered in K 6.2 / K 6.3 / K 6.4 and issues discovered during the last development stages of K 7.0.

The Kunena team is also pleased to announce the twelfth version of Kunena 6.4, a native Joomla extension for Joomla! 5.0, 5.1, 5.2, 5.3, 5.4 and 6.0.

Question Activity stream text limiting bug

More
14 years 9 months ago - 14 years 9 months ago #105998 by totvos
I just upgraded to 1.7 for the core Kunena plus the various plug-ins, including the JomSocial activity stream plug-in. The issue I am seeing is that when the text limiter is enabled, it sometimes leaves certain tags (div tags in particular) unclosed before adding the "read more" snippet. This results in my front page layout being totally destroyed.

I have noticed this in 1.6.x as well, but in 1.7 we have had this happen twice in two days. Is this a known issue? Is there a workaround (aside from me having to edit the rows in the database)?

Here is my configuration info:

This message contains confidential information

Database collation check: The collation of your table fields are correct

Legacy mode: Disabled | Joomla! SEF: Enabled | Joomla! SEF rewrite: Disabled | FTP layer: Disabled |htaccess: Exists | PHP environment: Max execution time: 300 seconds | Max execution memory: 128M | Max file upload: 2000M

This message contains confidential information

Joomla default template details : ja_social | author: JoomlArt.com | version: 1.2.0 | creationdate: 14/09/10

Kunena default template details : Blue Eagle (default) | author: Kunena Team | version: 1.7.0 | creationdate: 2011-08-29

Kunena version detailled: Installed version: 1.7.0 | Build: 5135 | Version name: Tale | Kunena detailled configuration:

Warning: Spoiler!

Third-party components: Jomsocial 2.0.4

Third-party SEF components: None

Plugins: System - Mootools Upgrade: Enabled | System - Mootools12: Disabled | Kunena Search 1.7.0 | My Kunena Forum Posts 1.7.0

Modules: Kunena Latest 1.7.0 | Kunena Stats 1.7.0

Last edit: 14 years 9 months ago by totvos. Reason: Removed some confidential info

Please Log in or Create an account to join the conversation.

More
14 years 9 months ago #106026 by totvos
Looking at the code, the issue is likely in KunenaParser::truncate, where the trimming of the activity stream entry is done. I *think* it might be the regex used to find the opening tags. In all cases where I have seen the error, the entry being trimmed is a quoted post, and so starts with something like:
Code:
<b>John Doe wrote:</b><br /> <div class="kmsgtext-quote">

I think that maybe the regex is skipping the div tag because of the "class" attribute.

Please Log in or Create an account to join the conversation.

More
14 years 9 months ago #106037 by totvos
Ok, so I isolated the "truncate" function into a small test page, and found that the issue is that the regular expression match strings are incorrect. Specifically, the following line to grab the $openedtags:
Code:
preg_match_all ( "#<([a-z][a-z0-9]?)( .*)?(?!/)>#iU", $tmp, $result );

should read something like this:
Code:
preg_match_all ( "#<([a-z0-9]+)( .*)?(?!/)>#iU", $tmp, $result );

and the code a few lines later to grab the $closedtags:
Code:
preg_match_all ( "#</([a-z]+)>#iU", $tmp, $result );

should actually be more like:
Code:
preg_match_all ( "#</([a-z0-9]+)>#iU", $tmp, $result );

For some reason beyond my regular expression fu, the "[a-z][a-z0-9]?" was not matching multi character open tags. Clearly, my fix would erroneously match something like "2h" as well, but it is better than not matching "div"! Similarly, the expression to match closing tags was missing the "0-9" part, so that it would potentially miss stuff like "</h2>".

This parsing and truncation code is not just used in the JomSocial activity stream stuff, but is core to Kunena for things like RSS. I hope this fix (or slightly better regex) gets into a patch soon. And if anyone can improve on what I have posted here, please do so.

Please Log in or Create an account to join the conversation.

More
14 years 9 months ago #106438 by Matias
The code has been taken directly from Joomla 1.7 without any code review.

Someone needs to report this also to Joomla tracker..

Please Log in or Create an account to join the conversation.

Time to create page: 0.263 seconds