#18704 closed defect (bug) (invalid)
WP_Widget_RSS widget outputs error if 0 posts found in feed. Should output "No posts found"
Reported by: | ericlewis | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.2.1 |
Component: | Widgets | Keywords: | has-patch dev-feedback |
Focuses: | Cc: |
Description
The output function for WP_Widget_RSS does a conditional check to see if the feed has returned an error, by checking if $rss->get_item_quantity() returns false. If it does return false the output says "An error occurred," which may not be true if the feed just has no posts yet.
This can be remedied by changing the conditional as I have, to check if $rss->get_item_quantity() is identical to false, so if the method get_item_quantity returns 0 an alternate else if will output "No posts found."
Attachments (1)
Change History (5)
#4
@
13 years ago
Yeah, the issue I was having was that if the fetch_rss() returned bad there would be a wp_error produced, whereas if the parsing of the feed gets far enough to check get_item_quantity(), it is a legitimate feed, that just may have no posts in it.
So perhaps the issue is just with the fact that is an RSS feed has 0 posts, the widget says there is an error with the feed, when it actually just has no posts in it. Not enough to reopen this ticket though, I'm not sure it's a legitimate concern.
As far as I can see,
get_item_quantity()
always returns a number (which I assume is the reason for closing).