[wp-trac] [WordPress Trac] #33003: making simplepie class resistant to leading whitespace feed issues
WordPress Trac
noreply at wordpress.org
Wed Jul 15 14:32:31 UTC 2015
#33003: making simplepie class resistant to leading whitespace feed issues
--------------------------------+-----------------------------
Reporter: cadeyrn | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: External Libraries | Version: 4.2.2
Severity: normal | Keywords:
Focuses: |
--------------------------------+-----------------------------
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);
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/33003>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list