Opened 16 years ago
Closed 16 years ago
#9273 closed defect (bug) (fixed)
Add RSS Error handling functionality to RSS Widget displays
Reported by: | DD32 | Owned by: | |
---|---|---|---|
Milestone: | 2.8 | Priority: | normal |
Severity: | normal | Version: | 2.8 |
Component: | General | Keywords: | has-patch |
Focuses: | Cc: |
Description
Upon hitting a SimplePie(and thus, WP_Error) error condition, The RSS widgets die with a fatal error.
Attached patch checks for WP_Error, and exits the function as expected (from pervious behaviour). If the user is an admin (Or its on the dashboard), The user recieves a message along the lines of "RSS Error: WP HTTP: no route to host"
Of course, The check for is_admin() can be removed.. Which might suit it better for cases where non-admins/non-staff access such pages.. Wasnt sure at the time of writing the patch.
Attachments (2)
Change History (7)
#3
@
16 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
trunk/wp-includes/widgets.php
1540 1540 function wp_widget_rss_output( $rss, $args = array() ) { 1541 1541 if ( is_string( $rss ) ) { 1542 1542 if ( !$rss = fetch_feed($rss) ) 1543 1543 return; 1544 1544 } elseif ( is_array($rss) && isset($rss['url']) ) { 1545 1545 $args = $rss; 1546 1546 if ( !$rss = fetch_feed($rss['url']) ) 1547 1547 return; 1548 1548 } elseif ( !is_object($rss) ) { 1549 return; 1550 }
needs to be cleaned up a bit more, Mainly refactoring the !$rss cases, Might need to check the rest of core for similar uses of fetch_feed().
I'll take a look later.
#4
@
16 years ago
attachment 9273.2.diff added
- Fixes this ticket.
- Completes error handling for all current core usage of fetch_feed()
- s/strstr/stristr/ to handle capitalised feed URL's past the first character(ie, it now handles
feed-HTTP://SITE/
as well asfeed-http://
) - changes some crazy wp-includes logic for the rss.png icon for the RSS Widget
- I dont know why it expects the custom rss.png to be in /wp-includes/ to start with.. Eitherway, The new code is readable..
Uh... I might've done that stupidly.
Of course, The problem is that fetch_feed() is returning a WP_Error now instead of false.. Since fetch_feed is going to return a simplepie object from now on, I've got a feeling it might be better to just continue to return a WP_Error, and ignore the back-compat since its already gone..