diff options
| author | 2017-04-08 18:03:52 +0200 | |
|---|---|---|
| committer | 2017-04-08 18:03:52 +0200 | |
| commit | fe494e000b37bb45ec3eb73f6ddb880fe613f64d (patch) | |
| tree | d67590e80c72912eb05526c7603e49ffe68c3f30 | |
| parent | 07a9faf851e3b887899564f854c9933bb0b99140 (diff) | |
try/catch for finfo_open
| -rw-r--r-- | CHANGELOG.md | 1 | ||||
| -rw-r--r-- | lib/Favicon/Favicon.php | 12 |
2 files changed, 9 insertions, 4 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index de9f2cc5d..e8a15ad1b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ * Bug fixing * Fix SQL uniqueness bug with PostgreSQL [#1476](https://github.com/FreshRSS/FreshRSS/pull/1476) * (Require manual update for existing installations) + * Do not require PHP extension `fileinfo` for favicons [#1461](https://github.com/FreshRSS/FreshRSS/issues/1461) * Fix UI lowest subscription popup hidden [#1479](https://github.com/FreshRSS/FreshRSS/issues/1479) * I18n * Improve English [#1465](https://github.com/FreshRSS/FreshRSS/pull/1465) diff --git a/lib/Favicon/Favicon.php b/lib/Favicon/Favicon.php index 4ee42ebbc..85d2ef19b 100644 --- a/lib/Favicon/Favicon.php +++ b/lib/Favicon/Favicon.php @@ -229,10 +229,14 @@ class Favicon $fileContent = $this->dataAccess->retrieveUrl($url); $this->dataAccess->saveCache($tmpFile, $fileContent); - $finfo = finfo_open(FILEINFO_MIME_TYPE); - $isImage = strpos(finfo_file($finfo, $tmpFile), 'image') !== false; - finfo_close($finfo); - + $isImage = true; + try { + $finfo = finfo_open(FILEINFO_MIME_TYPE); + $isImage = strpos(finfo_file($finfo, $tmpFile), 'image') !== false; + finfo_close($finfo); + } catch (Exception $e) { + } + unlink($tmpFile); return $isImage; |
