diff options
author | Andrew Dolgov <[email protected]> | 2021-02-06 17:38:24 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2021-02-06 17:38:24 +0300 |
commit | c94f1b6ff8a2a82fa0d6ad725144c5380fd0df7b (patch) | |
tree | 4b75ab38e2145422f4de313986ee7b32f1a92ade /classes/diskcache.php | |
parent | b6e1a5c91a0999a13eda4207fc23ff495637d697 (diff) |
fix some more warnings reported by phpstan
Diffstat (limited to 'classes/diskcache.php')
-rw-r--r-- | classes/diskcache.php | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/classes/diskcache.php b/classes/diskcache.php index daa171bf6..dcd7791d8 100644 --- a/classes/diskcache.php +++ b/classes/diskcache.php @@ -329,7 +329,9 @@ class DiskCache { } if ($need_saving) { - $doc->removeChild($doc->firstChild); //remove doctype + if (isset($doc->firstChild)) + $doc->removeChild($doc->firstChild); //remove doctype + $res = $doc->saveHTML(); } } @@ -384,7 +386,7 @@ class DiskCache { $mimetype_blacklist = [ "image/svg+xml" ]; /* only serve video and images */ - if (!preg_match("/(image|audio|video)\//", $mimetype) || in_array($mimetype, $mimetype_blacklist)) { + if (!preg_match("/(image|audio|video)\//", (string)$mimetype) || in_array($mimetype, $mimetype_blacklist)) { http_response_code(400); header("Content-type: text/plain"); @@ -403,7 +405,7 @@ class DiskCache { header("Content-type: $mimetype"); - $stamp = gmdate("D, d M Y H:i:s", filemtime($filename)) . " GMT"; + $stamp = gmdate("D, d M Y H:i:s", (int)filemtime($filename)) . " GMT"; header("Last-Modified: $stamp", true); return readfile($filename); |