1
0
Fork 0
forked from blallo/rss-bridge

[FeedExpander] Remove whitespace from source content

Whitespace at the beginning of feeds causes parsing errors. This is
an example using an ill-formatted RSS feed:

   "XML or text declaration not at start of entity"
-- https://validator.w3.org

This commit automatically removes all proceeding and trailing white-
space from the source content before resume parsing.
This commit is contained in:
logmanoriginal 2017-08-10 13:20:32 +02:00
parent ff3b1c9eb2
commit 8166e33e7f

View file

@ -18,7 +18,7 @@ abstract class FeedExpander extends BridgeAbstract {
*/ */
$content = getContents($url) $content = getContents($url)
or returnServerError('Could not request ' . $url); or returnServerError('Could not request ' . $url);
$rssContent = simplexml_load_string($content); $rssContent = simplexml_load_string(trim($content));
debugMessage('Detecting feed format/version'); debugMessage('Detecting feed format/version');
switch(true) { switch(true) {