MyBB Community Forums

Full Version: [F] RSS Feed Error [C-StefanT]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
When I post something, I usually include something like "[Admin]" at the front of the post title. But, when I look at it using the RSS, I get "& #93;", without quotes or the space, instead of "]", which I expect. How would I go about fixing this?

Displayed incorrectly: (IE & Firefox)
[attachment=14465]

Displayed correctly: (Safari)
[attachment=14466]

Thanks in advance!

EDIT: Only occurs in RSS not in Atom.

MyBB Version: 1.4.7

Reproducing: (Reproduced in either IE or Firefox)
1. http://community.mybboard.net/syndication.php?fid=82
2. Scroll to a post that is supposed to have a "[R]" or something like that.
3. Notice that the "[" is displayed correctly but the "]" is replaced with "& #93;"<- No space or quotes
Hmmm, inc/class_feedgenerator.php has a function sanitize_content() that's being used in different contexts (inside and outside of CDATA), and it sanitizes data in a funny way; replacing ] with & #93; (hmpf, can't even write it in a post) is done I guess because ]]> ends a CDATA section, but doing this is probably wrong (see the wikipedia article on CDATA, it shows how to escape ]]>).

I really hate XML, since it does these things to you; is CDATA necessary here at all? I removed it in my local copy of MyBB and replaced the sanitize_content with a simple htmlspecialchars_uni() and it seems to show up fine then, but I'm probably missing something. I don't have many RSS readers installed to test with either, since I don't use RSS myself - but my users keep asking for a better RSS so I'll have to write a plugin.
Proposed fix. In inc/class_feedgeneration.php find:

$content = str_replace("]]>", "]]&gt;", $content);

replace with:

$content = str_replace("]]>", "]]]]><![CDATA[>", $content);
Thank you for your bug report.

This bug has been fixed in our internal code repository. Please note that the problem will not be fixed here until these forums are updated.

With regards,
MyBB Group