[wp-trac] [WordPress Trac] #12059: fetch_feed($feedURL) throws an error when passed a bad feed...

WordPress Trac wp-trac at lists.automattic.com
Thu Jan 28 00:40:14 UTC 2010


#12059: fetch_feed($feedURL) throws an error when passed a bad feed...
-----------------------------+----------------------------------------------
 Reporter:  wickedbrilliant  |       Owner:             
     Type:  defect (bug)     |      Status:  new        
 Priority:  normal           |   Milestone:  Unassigned 
Component:  Feeds            |     Version:  2.9        
 Severity:  normal           |    Keywords:  fetch, feed
-----------------------------+----------------------------------------------
 If I call fetch_feed on a URL that is not a properly formed RSS feed, I
 don't generate any errors until I call a method on it, such as
 $feed->get_item_quantity()
 at which point it throws:
 Fatal error: Call to undefined method WP_Error::get_item_quantity()

 It doesn't seem to repond to:
 if ($feed->error())
 {
         echo $feed->error();
 }

 It would be nice if it failed quietly || returned false || returned some
 sort of error object. As it stands right now there is no way to catch
 errors.

 Try it:
 $feed = fetch_feed("http://www.espn.com/blah.htm");
 $feed->get_item_quantity();

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/12059>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list