diff --git a/templates/app_header.php b/templates/app_header.php index 7e289e4..d8e8632 100644 --- a/templates/app_header.php +++ b/templates/app_header.php @@ -1,5 +1,4 @@ - diff --git a/templates/bookmarks.php b/templates/bookmarks.php index 96f6afd..621181c 100644 --- a/templates/bookmarks.php +++ b/templates/bookmarks.php @@ -38,4 +38,4 @@ - + \ No newline at end of file diff --git a/vendor/PicoFeed/Parsers/Rss20.php b/vendor/PicoFeed/Parsers/Rss20.php index eba3b05..7437366 100644 --- a/vendor/PicoFeed/Parsers/Rss20.php +++ b/vendor/PicoFeed/Parsers/Rss20.php @@ -17,7 +17,7 @@ class Rss20 extends Parser $namespaces = $xml->getNamespaces(true); - if ($xml->channel->link->count() > 1) { + if ($xml->channel->link && $xml->channel->link->count() > 1) { foreach ($xml->channel->link as $xml_link) { @@ -40,6 +40,9 @@ class Rss20 extends Parser $this->updated = isset($xml->channel->pubDate) ? (string) $xml->channel->pubDate : (string) $xml->channel->lastBuildDate; $this->updated = $this->updated ? strtotime($this->updated) : time(); + // RSS feed might be empty + if (! $xml->channel->item) return $this; + foreach ($xml->channel->item as $entry) { $item = new \StdClass; diff --git a/vendor/PicoFeed/Reader.php b/vendor/PicoFeed/Reader.php index 308a65f..af5a7d9 100644 --- a/vendor/PicoFeed/Reader.php +++ b/vendor/PicoFeed/Reader.php @@ -51,11 +51,15 @@ class Reader public function getFirstTag($data) { - // Strip HTML comments - $data = preg_replace('//Uis', '', $data); + // Strip HTML comments (max of 5,000 characters long to prevent crashing) + $data = preg_replace('//Uis', '', $data); - // Strip Doctype - $data = preg_replace('//Uis', '', $data); + /* Strip Doctype: + * Doctype needs to be within the first 500 characters. (Ideally the first!) + * If it's not found by then, we need to stop looking to prevent PREG + * from reaching max backtrack depth and crashing. + */ + $data = preg_replace('/^.{0,500}]*)>/Uis', '', $data); // Find user_agent); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false); + curl_setopt($ch, CURLOPT_ENCODING, ''); // Don't check SSL certificates (for auto-signed certificates...) curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);