- The RSS 2.0 specification defines several optional channel elements : see http://cyber.law.harvard.edu/rss/rss.html#optionalChannelElements
format_rss_channel()allows optional channel elements to be passed as an array of optional parameters- however,
node_feeddoes not pass the extra elements it receives in$channeltoformat_rss_channel()when it invokes it to create the channel information
As a consequence, these optional fields are ignored, although everything is in place to include them. All it would take is:
- remove the already-used elements from the
$channelarray - pass the thus-trimmed
$channeltoformat_rss_channel()
The problem exists in D7 (today's HEAD), D6, D5, D4.7 and D4.6.
| Comment | File | Size | Author |
|---|---|---|---|
| #19 | 242991.patch | 2.99 KB | Carl Johan |
| #9 | node_feed-ignore-no-more.patch | 2.37 KB | Carl Johan |
| #8 | node_feed-ignore-no-more.patch | 2.5 KB | Carl Johan |
| #6 | node_feed-channel-elements-with-test-without-garbage.patch | 2.68 KB | Carl Johan |
| #5 | node_feed-channel-elements-with-test.patch | 2.69 KB | Carl Johan |
Comments
Comment #1
Carl Johan commentedComment #2
Carl Johan commentedPlox to review
Comment #3
Carl Johan commentedUpdated to use array_diff_key instead
Comment #5
Carl Johan commentedUpdated to include a test
Comment #6
Carl Johan commentedGarbage removed
Comment #8
Carl Johan commentedCleaned up the test description
Comment #9
Carl Johan commentedChanged tabs to spaces and array('') to array()
Comment #10
chx commentedNice job and welcome to the testing team :)
Comment #11
fgmHi Carl,
Thanks for this patch, which is just as I imagined it when I opened this issue. However, I thought a bit longer about it, and think it should include additional spec-defined elements and some safeguards:
Comment #12
Carl Johan commentedAh, hi fgm :)
This patch is just part 1 out of 2 in making it possible for modules to extend the core rss feed.
Would you accept moving those additional changes into another issue so that we could close this one? I would really love to be able to focus on allowing modules to extend the rss, before starting to extend it as you described. (My main reason for picking this up is that I'm playing around with rsscloud.)
Comment #13
chx commentedThe original issue is fixed. Ie now you can pass in extra channel tags to node_feed as the documentation/function signature always suggested you could.
I was looking for an RSS RFC because I felt uncomfortable about just adding a tag like that, however, the docs you linked lists copyright as an optional tag.
Adding other defaults inside node_feed is a separate issue IMO.
I am re-setting the issue to RTBC because I do not think it should be node_feed's task to enforce a standard like this... then we enter the quagmire of different RSS versions and so on. The patch is small and useful on its own. We can do more later.
Comment #14
webchickHm. This seems like quite a clever little workaround to this issue.
However, let's expand the documentation of node_feed() to hint at this new capability, since otherwise the only people who will know that it works this way are the 4 people in this issue. :P
Comment #15
Carl Johan commentedso, something like?
Comment #16
fgmI tend to agree with you: let's close this issue once the comments have been added as per webchick's suggestion... and open a separate issue for the elements validation.
However, regarding the problem with the quagmire of RSS versions, node_feed() already states (by including this in the
$channel_defaultsarray) that it generates RSS 2.0 if the caller does not specify otherwise, so it IMHO should abide by the specification it claims to support.Comment #17
Carl Johan commentedLooking at the spec you linked earlier the only required elements for RSS 2.0 are title, link and description. And since they're always included, the claim is correct?
Regarding the documentation, I don't know if my comment is too technical, just pointing at the two functions? There's a good example in the documentation of format_xml_elements() that I felt should be referenced, but simply making a copy seems a bit overkill.
Thoughts?
Comment #18
chx commentedI think that will be just fine. api.drupal.org crosslinks functions like that if you use the () as you did.
Comment #19
Carl Johan commentedComment #20
Carl Johan commentedComment #21
chx commentednice bugfix.
Comment #22
dries commentedThe test is a bit odd -- suggests that we have an API problem. Probably OK for D7 though.
Comment #23
dries commentedCommitted this patch, but accidentically as part of another patch. Sorry for not having given credit.