• Hi.
    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.
    Bye, Mike

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thanks,
    these are no fixed and committed to CVS.
    Note I hand merged your patches as they were against an old version.
    Mike

    Thread Starter otaku42

    (@otaku42)

    Erm… old version? I thought I was using the up-to-date version… at least the latest which was officially released on sourceforge, which is 0.71. Have I’ve been wrong with that assumption?
    Bye, Mike

    0.71 is the latest “release” version. But there is also 0.72beta which is currently under development. And the CVS repository always has the most up-to-date changes (well, plus any new bugs we’ve introduced ?? )

    Thread Starter otaku42

    (@otaku42)

    By the way, I found another bug in rss/rdf-feed generators. The version delivered along with v0.71 would generally pass chars to the rss/rdf that must be properly encoded (for example the & has to become & in order to have valid xml).
    The reason is that in b2rss2.php and b2rdf.php the call to the_content_rss and the_excerpt_rss is done with a “2” as second parameter. In b2rss.php the second parameter to this functions is $rss_encoded_html instead. For me it worked to set the second parameter of the mentioned functions to $rss_encoded_html instead – but maybe it would be better to add a call to htmlspecialchars within the_excerpt_rss and the_content_rss for $encode_html==2?
    Bye, Mike

    Thread Starter otaku42

    (@otaku42)

    @dougal: Ah, I see… is it wise to use the CVS version within an “production environment”? So far things work fine for me with 0.71 (apart from some minor things that I’ve mentioned here during the last days).

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘bug in rss/rdf-feeds’ is closed to new replies.