RSS Feed from Forums Broken

Maybe I’m the only one, but I subscribe to the forums in Google Reader, and all along, while Google Reader will grab the articles, the link provided to them is incorrect due to missing &'s.

So instead of something like:
http://www.wickededgeusa.com/index.php?option=com_kunena&func=view&catid=9&id=5952&Itemid=63
it’s
http://www.wickededgeusa.com/index.php?option=com_kunenafunc=viewcatid=9id=5952Itemid=63#5952

Obviously incorrect.

I’m not sure, but it appears this may be due to some weird configuration with the RSS feed being redirected.

Is anyone else seeing this issue? I’d be happy to troubleshoot/diagnose further if needed/wanted.

Hi Staze,

Thank you for pointing this out. I’ll pass it along to our webmaster right away.

–Clay

[quote quote=“Staze” post=5979]Maybe I’m the only one, but I subscribe to the forums in Google Reader, and all along, while Google Reader will grab the articles, the link provided to them is incorrect due to missing &'s.

So instead of something like:
http://www.wickededgeusa.com/index.php?option=com_kunena&func=view&catid=9&id=5952&Itemid=63
it’s
http://www.wickededgeusa.com/index.php?option=com_kunenafunc=viewcatid=9id=5952Itemid=63#5952

Obviously incorrect.

I’m not sure, but it appears this may be due to some weird configuration with the RSS feed being redirected.

Is anyone else seeing this issue? I’d be happy to troubleshoot/diagnose further if needed/wanted.[/quote]

Note the RSS feed fails validation:

http://validator.w3.org/appc/check.cgi?url=http%3A%2F%2Fwww.wickededgeusa.com%2Findex.php%3Foption%3Dcom_kunena%26func%3Drss%26catid%3D3%26Itemid%3D63

It would seem the missing &'s may be a bug with Google Reader dealing with malformed XML, but I’m not 100% confident on that. Attempting to curl the rss feed results in a 303 “See Other” which seems… odd. But maybe that’s how IIS deals with basic redirects.

[quote quote=“wickededge” post=5981]Hi Staze,

Thank you for pointing this out. I’ll pass it along to our webmaster right away.

–Clay

[/quote]

Clay,

Awesome. Let him/her know I’d be happy to help test fixes, confirm it works, etc. They’re welcome to contact me directly if desired.

Indeed.

I did find this: http://www.kunena.org/forum/4/2393-enhanced-kunena-rss-feed/15078 via google, but I don’t have an account, so I can’t read it.

I just looked for “kunena” and amp;.

There’s this too: http://www.kunena.org/forum/159-K-17-Common-Questions/93971-rss-feed-is-not-working

Part of it may be just the fairly old version of Kunena that’s being used. Looks like it’s from 10/2010 or so. =/

Firefox doesn’t show ANYTHING other than the forum title for the RSS feed. Having coded my own RSS feed generators previously, I know that if something doesn’t pass that W3 validator, all kinds of weird crap can happen at the client end. I’m guessing that Line 19 error here is probably a good chunk of the issues.

lol. Figures Outlook would ignore the issues.

Do the links to the actual forum thread work in Outlook? Guess I can try Mac Mail…

Mac Mail RSS reader works too, and all the links for read more work. Interesting…

So Google reader is just being wonky with the validation issues.

It LOOKS like the RSS feed should be feeding “escaped” ampersands: http://stackoverflow.com/questions/1030102/why-cant-rss-handle-the-ampersand rather than &. Which makes sense, but I’m not sure it was ever allowed. Which would make sense why Reader is removing them, since they’re not allowed. No idea why Outlook and Mail simply allow them. Guessing to appease noisy RSS feeds.

http://www.therssweblog.com/?guid=20070522124846

Which makes me think… I’m going to run a quick test. Give me a few…

You must be working on it at the same time, because now I’m getting weird results.

I was attempting to read in the RSS line by line, then replace any instances of & in a link or guid, with an &, but it appears some URLS now have & and some don’t.

So, will let you continue working. Let me know if you need additional input/testing. Thanks!

It’s not me, but it might be the webmaster working at it too. I’ll check with him and see what he has to say.

[quote quote=“Staze” post=6007]You must be working on it at the same time, because now I’m getting weird results.

I was attempting to read in the RSS line by line, then replace any instances of & in a link or guid, with an &, but it appears some URLS now have & and some don’t.

So, will let you continue working. Let me know if you need additional input/testing. Thanks![/quote]

Okay, here’s what I’ve got at this point:

http://www.staze.org/static/fixwerss.php

This allows google reader to work…

All I’m doing is reading in the RSS line by line, and looking for any line that has in it, and then replacing any & with &

foreach($feed_array as $line) { if(preg_match("",$line)) { $fixed = preg_replace("/&amp;/", "&amp;", $line); } elseif (preg_match("<title>",$line)) { $fixed = preg_replace("/&amp;/", "&amp;", $line); } else { $fixed = $line; } echo $fixed; }

I was also trying to fix the & in the field, but it doesn’t seem to be working, but on the positive side, that doesn’t seem to be breaking google reader.

Whole code is here:

[code]<?php
header('Content-Type: text/xml; charset=UTF-8');
function get_url_contents($url) {
//echo $url;
$crl = curl_init();
$timeout = 5;
curl_setopt ($crl, CURLOPT_URL, $url);
curl_setopt ($crl, CURLOPT_RETURNTRANSFER, 1);
//curl_setopt ($crl, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt ($crl, CURLOPT_HEADER, 0);
curl_setopt ($crl, CURLOPT_USERAGENT, "Mozilla/4.0");
$ret = curl_exec($crl);
curl_close($crl);
return $ret;
}

$url = 'http://www.wickededgeusa.com/index.php?option=com_kunena&amp;func=rss&amp;Itemid=63&#039;;
$feed = get_url_contents($url);
$feed_array = explode("r", $feed);
//print_r($feed);
foreach($feed_array as $line) {
if(preg_match("“,$line)) {
$fixed = preg_replace(”/&/“, “&”, $line);
} elseif (preg_match(”“,$line)) {
$fixed = preg_replace(”/&/", “&”, $line);
} else {
$fixed = $line;
}
echo $fixed;
}

?>[/code]

btw, realize the code is less than stellar. This is largely reused from fixing issues with Facebook’s broken RSS feeds…

okay, it isn’t perfectly validating (there’s currently no guid’s), but here ya go:

Validator
RSS Fixer

[code]<?php
header('Content-Type: text/xml; charset=UTF-8');
function get_url_contents($url) {
//echo $url;
$crl = curl_init();
$timeout = 5;
curl_setopt ($crl, CURLOPT_URL, $url);
curl_setopt ($crl, CURLOPT_RETURNTRANSFER, 1);
//curl_setopt ($crl, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt ($crl, CURLOPT_HEADER, 0);
curl_setopt ($crl, CURLOPT_USERAGENT, "Mozilla/4.0");
$ret = curl_exec($crl);
curl_close($crl);
return $ret;
}

$url = 'http://www.wickededgeusa.com/index.php?option=com_kunena&amp;func=rss&amp;Itemid=63&#039;;
$feed = get_url_contents($url);
//$feed_array = explode("r", $feed);
$feed_array = preg_split('/n|r/', $feed, -1, PREG_SPLIT_NO_EMPTY);
foreach($feed_array as $line) {
if(preg_match("“,$line)) {
$fixed = preg_replace(”/&/“, “&”, $line);
$root_link_parts = preg_split(‘/>|</', $fixed, -1);
$root_link = $root_link_parts[2];
//$fixed = $fixed . "n" . '’ . $root_link . ‘’;
} elseif(preg_match(”//“,$line) == 1) {
$fixed = preg_replace(”/&/“, “”, $line);
} elseif(preg_match(”//",$line) == 1) {
$fixed = ‘’;
} elseif(preg_match(‘//’, $line)) {
$fixed = $line . “n” . ‘’;
} else {
$fixed = $line;
}
echo $fixed . “n”;
}

?>[/code]

Got GUID’s working.

Now the only error is the image “link”. But that’s really nothing, other than just being nit picky.

Thanks Staze for bringing this up and all your help in getting it resolved!

[quote quote=“Staze” post=6020]Got GUID’s working.

Now the only error is the image “link”. But that’s really nothing, other than just being nit picky.[/quote]

no prob. It’d been bugging me for a bit, but I figured I’d finally report it. =P

Until now I hadn’t done the legwork to actually figure out what was going on, just that the links didn’t work.

Obviously the issue should be fixed via patching Kunena, but my code should fix a general idea of the issue. The biggest one, is not HTML encoding the url’s under . Once that’s addressed, I’m guessing the RSS will validate, albeit messily.

If I have time tomorrow I’ll look at the code for 1.6 and see if I can figure out where it’s going wrong.

And Clay, this is the least I can do given the product. =)

Okay, found the fix.

After installing Joomla 1.5.21, and Kunena 1.6, I found the configuration option that’s the issue.

In the Joomla administration area, under Components, Kunena Forum, Configuration. In there is an RSS tab. Change the RSS Specification to RSS 2.0, and save. That should fix the issue. I’m guessing right now it’s set to RSS 0.91, or RSS 1.0, both of which are pretty old at this point, and setting them that way is not really needed anymore.

Give that a shot, and let me know, and I’ll give it a test. Weird that RSS previous to 2.0 allowed non-encoded URLs…

Thanks!

Though now that I look at the RSS feed raw, it says it’s RSS 2.0, but obviously isn’t valid.

Any chance you could tell which which specific version numbers of Kunena and Joomla are being run? I only see the major versions (Joomla 1.5, and Kunena 1.6).

Or maybe just the version of joomla/libraries/joomla/document/feed/renderer/rss.php (version should be at the top).

I’m a bit confused, as it seems like link’s in general aren’t being url encoded… which makes me think something is wonky.

Thanks!

Here are the Joomla! specs:

PHP Built on: Windows NT WEBB38 6.1 build 7601
Database Version: 5.0.54-log
Database Collation: utf8_general_ci
PHP Version: 5.2.17
Web Server: Microsoft-IIS/7.5
Web Server to PHP interface: cgi-fcgi
Joomla! Version: Joomla! 1.5.20 Stable [ senu takaa ] 18-July-2010 18:00 GMT
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.92 Safari/537.4

and the Kunena specs:

Installed version: Kunena 1.6.3