bug in rss/rdf-feeds
I discovered a bug in b2rss.php, b2rss2.php and b2rdf.php. It occurs if there are no posts to be included as items in the feed. This happens in two situations:
1. no category is specified (i.e. there is no cat=x in the GET-variables) and there is no posting at all in the blog, or
2. a category is specified (i.e. with cat=x) and there is no posting in the specified category.
In each of this two cases there will be an error message in the feed-file, saying something like “Invalid argument supplied for foreach()”. The variable $posts is empty but gets passed without check to a foreach-statement, which results in the mentioned error message.
The solution is to simply check if there is anything in $posts before executing the foreach-statement. I’ll submit three patches into the bugtracker at sourceforge.net to fix this.
- The topic ‘bug in rss/rdf-feeds’ is closed to new replies.