[BUGFIX] Fix faulty negation in FileInfo implementation 05/37205/2
authorSascha Egerer <sascha.egerer@dkd.de>
Wed, 25 Feb 2015 11:45:35 +0000 (12:45 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Wed, 25 Feb 2015 12:41:46 +0000 (13:41 +0100)
A faulty negation in the FileInfo class could end in a fatal
error if `finfo` is not supported by the php version and ends up
in not using `finfo` but `mime_content_type` if `finfo` is
supported.

Resolves: #65329
Releases: master
Change-Id: I768d70501ee4a8f03317563cef2d95e59e791e7d
Reviewed-on: http://review.typo3.org/37205
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/core/Classes/Type/File/FileInfo.php

index d7ce885..b7f7d10 100644 (file)
@@ -24,12 +24,12 @@ class FileInfo extends \SplFileInfo implements TypeInterface {
        /**
         * Return the mime type of a file.
         *
-        * @return string|FALSE
+        * @return string|bool Returns the mime type or FALSE if the mime type could not be discovered
         */
        public function getMimeType() {
                $mimeType = FALSE;
                if ($this->isFile()) {
-                       if (!function_exists('finfo_file')) {
+                       if (function_exists('finfo_file')) {
                                $fileInfo = new \finfo();
                                $mimeType = $fileInfo->file($this->getPathname(), FILEINFO_MIME_TYPE);
                        } elseif (function_exists('mime_content_type')) {