WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 2 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
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 3 years ago.
patch file for simplepie

Download all attachments as: .zip

Change History (6)

@cadeyrn
3 years ago

patch file for simplepie

#1 @dd32
3 years ago

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

@rmccue thoughts?

#2 @cadeyrn
3 years ago

Hi there, any news on this?

#3 @cadeyrn
2 years ago

  • Keywords has-patch added

#4 @ssuess
15 months ago

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

#5 @ssuess
2 months ago

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

Note: See TracTickets for help on using tickets.