summaryrefslogtreecommitdiff
path: root/classes/opml.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-02-06 17:38:24 +0300
committerAndrew Dolgov <[email protected]>2021-02-06 17:38:24 +0300
commitc94f1b6ff8a2a82fa0d6ad725144c5380fd0df7b (patch)
tree4b75ab38e2145422f4de313986ee7b32f1a92ade /classes/opml.php
parentb6e1a5c91a0999a13eda4207fc23ff495637d697 (diff)
fix some more warnings reported by phpstan
Diffstat (limited to 'classes/opml.php')
-rw-r--r--classes/opml.php11
1 files changed, 7 insertions, 4 deletions
diff --git a/classes/opml.php b/classes/opml.php
index 37e653a39..bc2d4d7b9 100644
--- a/classes/opml.php
+++ b/classes/opml.php
@@ -272,7 +272,7 @@ class Opml extends Handler_Protected {
$doc->preserveWhiteSpace = false;
$doc->loadXML($out);
- $xpath = new DOMXpath($doc);
+ $xpath = new DOMXPath($doc);
$outlines = $xpath->query("//outline[@title]");
// cleanup empty categories
@@ -534,10 +534,11 @@ class Opml extends Handler_Protected {
$outlines = $root_node->childNodes;
} else {
- $xpath = new DOMXpath($doc);
+ $xpath = new DOMXPath($doc);
$outlines = $xpath->query("//opml/body/outline");
$cat_id = 0;
+ $cat_title = false;
}
#$this->opml_notice("[CAT] $cat_title id: $cat_id P_id: $parent_id");
@@ -593,7 +594,7 @@ class Opml extends Handler_Protected {
}
if (is_uploaded_file($_FILES['opml_file']['tmp_name'])) {
- $tmp_file = tempnam(CACHE_DIR . '/upload', 'opml');
+ $tmp_file = (string)tempnam(CACHE_DIR . '/upload', 'opml');
$result = move_uploaded_file($_FILES['opml_file']['tmp_name'],
$tmp_file);
@@ -607,13 +608,15 @@ class Opml extends Handler_Protected {
return;
}
+ $loaded = false;
+
if (is_file($tmp_file)) {
$doc = new DOMDocument();
libxml_disable_entity_loader(false);
$loaded = $doc->load($tmp_file);
libxml_disable_entity_loader(true);
unlink($tmp_file);
- } else if (!$doc) {
+ } else if (empty($doc)) {
print_error(__('Error: unable to find moved OPML file.'));
return;
}