summaryrefslogtreecommitdiff
path: root/classes/feedparser.php
diff options
context:
space:
mode:
authorwn_ <[email protected]>2021-11-14 16:59:21 +0000
committerwn_ <[email protected]>2021-11-14 16:59:21 +0000
commitf5c881586bd6eb41036e36625f426c00aa993c4f (patch)
treeb135272d0f9905d4f450221156d4b586984d3381 /classes/feedparser.php
parent7988c79bd40356b62d9f1bca03284c0b35a49fcd (diff)
Handle potentially null link, title, etc. in FeedParser.
Diffstat (limited to 'classes/feedparser.php')
-rw-r--r--classes/feedparser.php16
1 files changed, 7 insertions, 9 deletions
diff --git a/classes/feedparser.php b/classes/feedparser.php
index 05412ef1e..abf1545f8 100644
--- a/classes/feedparser.php
+++ b/classes/feedparser.php
@@ -11,18 +11,18 @@ class FeedParser {
private $libxml_errors = [];
/** @var array<FeedItem> */
- private $items;
+ private $items = [];
- /** @var string */
+ /** @var string|null */
private $link;
- /** @var string */
+ /** @var string|null */
private $title;
- /** @var int */
+ /** @var FeedParser::FEED_*|null */
private $type;
- /** @var DOMXPath */
+ /** @var DOMXPath|null */
private $xpath;
const FEED_RDF = 0;
@@ -49,8 +49,6 @@ class FeedParser {
}
}
libxml_clear_errors();
-
- $this->items = array();
}
function init() : void {
@@ -208,11 +206,11 @@ class FeedParser {
}
function get_link() : string {
- return clean($this->link);
+ return clean($this->link ?? '');
}
function get_title() : string {
- return clean($this->title);
+ return clean($this->title ?? '');
}
/** @return array<FeedItem> */