WordPress.org

Make WordPress Core

Opened 4 years ago

Last modified 3 months ago

#33003 assigned enhancement

making simplepie class resistant to leading whitespace feed issues

Reported by: cadeyrn Owned by: rmccue
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.2.2
Component: External Libraries Keywords: has-patch reporter-feedback
Focuses: Cc:
PR Number:

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 4 years ago.
patch file for simplepie

Download all attachments as: .zip

Change History (7)

@cadeyrn
4 years ago

patch file for simplepie

#1 @dd32
4 years ago

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

@rmccue thoughts?

#2 @cadeyrn
4 years ago

Hi there, any news on this?

#3 @cadeyrn
4 years ago

  • Keywords has-patch added

#4 @ssuess
3 years ago

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

#5 @ssuess
21 months ago

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

#6 @Hareesh Pillai
3 months 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 3 months ago by Hareesh Pillai (previous) (diff)
Note: See TracTickets for help on using tickets.