Ver Fonte

[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.
logmanoriginal há 6 anos atrás
pai
commit
8166e33e7f
1 ficheiros alterados com 1 adições e 1 exclusões
  1. 1 1
      lib/FeedExpander.php

+ 1 - 1
lib/FeedExpander.php

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