diff options
| author | 2017-04-09 08:58:41 +0200 | |
|---|---|---|
| committer | 2017-04-09 08:58:41 +0200 | |
| commit | c5e9fee5a7700b3ba8fae4e1c454e8fd46606d8b (patch) | |
| tree | 89da02a926af07520b02b030c5dd9fbedf515ed8 /lib | |
| parent | 8af3c9841e7040b91282f24cdccc0e215c52ceef (diff) | |
| parent | a542ab8fff7cd13ef54f5585f029b6c1d2244351 (diff) | |
Merge pull request #1491 from Alkarex/check_fileinfo
Check for fileinfo
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/Favicon/Favicon.php | 14 | ||||
| -rw-r--r-- | lib/lib_install.php | 2 |
2 files changed, 10 insertions, 6 deletions
diff --git a/lib/Favicon/Favicon.php b/lib/Favicon/Favicon.php index 8571a1b95..85d2ef19b 100644 --- a/lib/Favicon/Favicon.php +++ b/lib/Favicon/Favicon.php @@ -179,7 +179,7 @@ class Favicon // Sometimes people lie, so check the status. // And sometimes, it's not even an image. Sneaky bastards! // If cacheDir isn't writable, that's not our problem - if ($favicon && is_writable($this->cacheDir) && !$this->checkImageMType($favicon)) { + if ($favicon && is_writable($this->cacheDir) && extension_loaded('fileinfo') && !$this->checkImageMType($favicon)) { $favicon = false; } @@ -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; diff --git a/lib/lib_install.php b/lib/lib_install.php index 76871c98a..c625a670a 100644 --- a/lib/lib_install.php +++ b/lib/lib_install.php @@ -67,7 +67,7 @@ function checkRequirements($dbType = '') { 'favicons' => $favicons ? 'ok' : 'ko', 'http_referer' => $http_referer ? 'ok' : 'ko', 'message' => $message ?: 'ok', - 'all' => $php && $minz && $curl && $pdo && $pcre && $ctype && $fileinfo && $dom && $xml && + 'all' => $php && $minz && $curl && $pdo && $pcre && $ctype && $dom && $xml && $data && $cache && $users && $favicons && $http_referer && $message == '' ? 'ok' : 'ko' ); |
