Make WordPress Core

Opened 9 years ago

Closed 4 years ago

#33003 closed enhancement (reported-upstream)

making simplepie class resistant to leading whitespace feed issues

Reported by: cadeyrn's profile cadeyrn Owned by: rmccue's profile rmccue
Milestone: Priority: normal
Severity: normal Version: 4.2.2
Component: External Libraries Keywords: has-patch
Focuses: Cc:

Description

Unfortunately it's a common issue with WordPress feeds that they end up having a leading whitespace or a linebreak before the XML header. Thus fetching RSS feeds with SimplePie fails with messages like:

PHP Notice: This XML document is invalid, likely due to invalid characters. XML error: Reserved XML Name at line 2, column 38 in /home/wordpress/wp-includes/class-simplepie.php on line 1446

In order to make the SimplePie class resistant to this error, a simple trim function should be introduced on the raw data before further parsing:

1605c1605,1606
< 		$this->raw_data = $file->body;
---
> 		// whitespace before XML resistance
> 		$this->raw_data = trim($file->body);

Attachments (1)

simplepie.patch (525 bytes) - added by cadeyrn 9 years ago.
patch file for simplepie

Download all attachments as: .zip

Change History (8)

@cadeyrn
9 years ago

patch file for simplepie

#1 @dd32
9 years ago

  • Owner set to rmccue
  • Status changed from new to assigned

@rmccue thoughts?

#2 @cadeyrn
9 years ago

Hi there, any news on this?

#3 @cadeyrn
9 years ago

  • Keywords has-patch added

#4 @ssuess
8 years ago

Will this ever be added to core? It really helps.

#5 @ssuess
7 years ago

STILL a big problem, and so easy to fix. Why isn't this in core?

#6 @Hareesh Pillai
5 years ago

  • Keywords reporter-feedback added

Hi, the SimplePie library has been updated in core. Can you confirm if this issue is still observed in the latest version of WordPress?

Note that SImplePie is an external library. We don't usually patch those in WordPress, but instead, request a change upstream and update to a newer version of the library, if it exists.

@cadeyrn @ssuess

Last edited 5 years ago by Hareesh Pillai (previous) (diff)

#7 @desrosj
4 years ago

  • Keywords reporter-feedback removed
  • Milestone Awaiting Review deleted
  • Resolution set to reported-upstream
  • Status changed from assigned to closed

This appears to have been fixed upstream in https://github.com/simplepie/simplepie/pull/445.

While that fix has not been merged into core, #36669 will handle that, so I am going to close this one out.

Note: See TracTickets for help on using tickets.