RSS feed not validating

moullas

Joined: 2011-11-07
Posts: 9
Posted: Wed, 2011-11-09 23:51

Vanilla installation

http://www.40thscouts.org/gallery/

Tried validating the RSS feed, and getting the "pubDate must be an RFC-822 date-time: Thu, 10 Nov 2011 01:42:48 EET" message when running it through W3C validator

Strange thing is...
My main site's RSS is giving as an example a pubdate like this:
<pubDate>Tue, 08 Nov 2011 20:12:26 +0200</pubDate>

Gallery's pubdate gives the following:
<pubDate>Tue, 08 Nov 2011 19:55:11 EET</pubDate>

Only difference is +0200 instead of EET...
I looked around in the /rss/ module but couldn't find something there to change.. halp?

/Edit/
After some quick digging around.. the RSS spec supports only either a time offset or a predifined list of time zones as per RFC822
EET apparently is not in that list.. i don't know if it was set by my webserver or is hardcoded into gallery, but changing that would be a fix..

Btw, I've set the timezone in the advanced configuration as +2 if it matters (don't know if that is valid or not, but it looks like time in Gallery is correct), but the RSS feed in not fixed :(

 
moullas

Joined: 2011-11-07
Posts: 9
Posted: Thu, 2011-11-10 10:18

Found the bug.. don't know how to submit the fix properly, so here is the fixes i made in the RSS module:
Hope someone see's this and submits it to code

/modules/rss/controllers/rss.php
Line 53 : Fixes the date to RFC822 compliant, mistake was in the end, T is invalid, O gives GMT offset.
FROM
$view->pub_date = date("D, d M Y H:i:s T");
to
$view->pub_date = date("D, d M Y H:i:s O");

Line 62 : Sets the headers correctly to xml, if you view the source now it is properly formatted XML
FROM
header("Content-Type: application/rss+xml");
TO
header('Content-Type: text/xml; charset=utf-8');

modules/rss/views/feed.mrss.php
Line 28 : Fixes time formatting to RFC822 compliant ("r" formats the date, could also change the date("D, d M Y H:i:s T" to date("D, d M Y H:i:s O")
FROM
<pubDate><?= date("D, d M Y H:i:s T", $item->created); ?></pubDate>
TO
<pubDate><?= date("r", $item->created); ?></pubDate>

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 25961
Posted: Thu, 2011-11-10 22:01

Thanks for investigating.
I have created https://sourceforge.net/apps/trac/gallery/ticket/1798 so it does not get lost.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
moullas

Joined: 2011-11-07
Posts: 9
Posted: Fri, 2011-11-11 06:39

Thanks Dave.

I think you can easily test a feed from any other gallery using a Feed Validator.

However, i don't know if i stumbled upon this problem due to how the time is set on my hosting provider, thus showing the problem to me and not to users in other time zones...

 
mr.xy

Joined: 2011-09-20
Posts: 66
Posted: Fri, 2012-05-04 06:56

@moullas: Thanks a lot for this fix! Now it validates.

Would be great, if this could be corrected in the gallery-bundle and on gallerymodules.com, since it shipswith the standard installation.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 25961
Posted: Mon, 2012-05-07 22:24

Fixed in this commit:
https://github.com/gallery/gallery3/commit/6effd5f75ee6a0972b0fbad5a15c6b7e8bf5ce8e

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team