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 | Owned by: | 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)
Change History (8)
#6
@
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
#7
@
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.
patch file for simplepie