WordPress.org

Make WordPress Core

Opened 22 months ago

Last modified 22 months ago

#21017 reviewing enhancement

Using force_feed() for simplepie in core

Reported by: josh401 Owned by: nacin
Milestone: Awaiting Review Priority: normal
Severity: minor Version: 3.4
Component: Feeds Keywords: has-patch dev-feedback
Focuses: Cc:

Description

Receiving the following error in the "Incoming Links" widget in the admin dashboard:

RSS Error: A feed could not be found at http://www.google.com/search?
ie=utf-8&partner=wordpress&q=link:http://mysite.com/
&tbm=blg&tbs=sbd:1&output=rss. A feed with an invalid mime type may fall
victim to this error, or SimplePie was unable to auto-discover it.. Use
force_feed() if you are certain this URL is a real feed.


The support forum thread which can provide more specific information can be found here:
http://wordpress.org/support/topic/incoming-links-error-message-1?replies=41


It has been suggested adding force_feed() to the core might alleviate this issue in future dev.

Attachments (1)

dashboard.php.patch (691 bytes) - added by devgav 22 months ago.

Download all attachments as: .zip

Change History (12)

comment:1 SergeyBiryukov22 months ago

Per ScottJWalter's comment, might be an issue with Google's protection mechanism.

Makes sense to me, since I recently started seeing this error in 3.1 to 3.3 installs, not just in 3.4.

I've performed a quick test to see what fetch_feed() receives, and got a CAPTCHA page. force_feed() wouldn't help in this case.

comment:2 josh40122 months ago

I am fairly certain (not positive) that I was receiving this error prior to the 3.4 update. So I agree this has also been evident in prior version installs.

And I have also seen the feed generate the error; a few days later it works; and then it went to generating the error again.

I will research the Google docs for this issue and see what I can uncover.

comment:3 nacin22 months ago

I would like to try to catch and suppress these errors for this widget, and issue a more graceful error message. This widget is an RSS widget underneath, but we don't need to expose raw SimplePie error messages for any of them.

comment:4 devgav22 months ago

  • Cc devgav added

From WP-Forums mailing list:

Try to avoid force_feed, as SimplePie is good at detecting valid feeds - if it's invalid, it's normally invalid for a reason.

Force feed action hook sample for further testing / reference:

add_action('wp_feed_options', 'force_feed', 10, 1); 
function force_feed($feed) {
	$feed->force_feed(true);
}

You can also get the URL at this point if you want to do some checking:

add_action('wp_feed_options', 'force_feed', 10, 2); 
function force_feed($feed, $url) {
	if ($url == 'something') {
		$feed->force_feed(true);
	}
}

comment:5 josh40122 months ago

Correct.

When using the wp_feed_options filter, and setting force_feed to true, and also setting the url will result in this notice:

RSS Error: This XML document is invalid, likely due to invalid
characters. XML error: syntax error at line 1, column 62

Here is the link to SimplePie API reference if it can be of any help:
http://simplepie.org/wiki/reference/start

devgav22 months ago

comment:6 devgav22 months ago

Simple RSS error suppression for Incoming Links widget.

If (!WP_DEBUG) returns:

 __('Sorry, there has been an error loading the Incoming Links widget right now. Please try again later.')

Otherwise if WP_DEBUG == true, returns standard RSS SimplePie error.

comment:7 devgav22 months ago

  • Keywords has-patch added

comment:8 devgav22 months ago

  • Keywords dev-feedback added
  • Owner set to nacin
  • Status changed from new to reviewing

Just to clarify my views on force_feed() here ... I don't feel this is the solution.

An invalid feed should fail by design. We don't want to force it through. force_Feed in SimplePie was designed to handle incorrect mime types, not to magically fixed broken feeds. These should be taken up with the feed provider.

SimplePie Ref: http://simplepie.org/wiki/reference/simplepie/force_feed

Hiding the error message, as per patch/Nacin's request should be the solution in this ticket.

comment:9 devgav22 months ago

  • Severity changed from normal to minor
  • Type changed from defect (bug) to enhancement

comment:10 WraithKenny22 months ago

WordPress has this widget which maybe be useful for some users, but not so much for a fresh installed blog (and other user may not even be interested). According to a quick read of ScottJWalter's comment, Google gets 'unusual traffic', and turns it off for "robots" via a captcha check (default WordPress probably counts in this regard). Perhaps we should respect that, and turn it off by default (for new installs), and let users turn it on if they want, via a plugin or option.

comment:11 WraithKenny22 months ago

I addition, perhaps when 'Site Visibility' is set to not index, we shouldn't do the dashboard widget. Sorta fits I think.

Anyway, friendlier errors would certainly be nice for end users.

Note: See TracTickets for help on using tickets.