[BUGFIX] Declare mimetype property in FAL as string 86/43286/2
authorStephan Großberndt <stephan@grossberndt.de>
Mon, 14 Sep 2015 08:29:50 +0000 (10:29 +0200)
committerNicole Cordes <typo3@cordes.co>
Tue, 15 Sep 2015 13:21:14 +0000 (15:21 +0200)
This patch properly declares the mimetype property in all FAL classes
as string instead of array.

Resolves: #69772
Releases: master
Change-Id: Ie9af4411122ecd8d915e7c98da5c573931e12392
Reviewed-on: http://review.typo3.org/43286
Reviewed-by: Frans Saris <franssaris@gmail.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Michael Oehlhof <typo3@oehlhof.de>
Tested-by: Michael Oehlhof <typo3@oehlhof.de>
Reviewed-by: Frederic Gaus <frederic.gaus@flagbit.de>
Tested-by: Frans Saris <franssaris@gmail.com>
Reviewed-by: Stefan Froemken <froemken@gmail.com>
Reviewed-by: Nicole Cordes <typo3@cordes.co>
Tested-by: Nicole Cordes <typo3@cordes.co>
typo3/sysext/core/Classes/Resource/AbstractFile.php
typo3/sysext/core/Classes/Resource/Driver/LocalDriver.php
typo3/sysext/core/Classes/Resource/FileInterface.php
typo3/sysext/core/Classes/Resource/FileReference.php

index 5ea409e..6332c94 100644 (file)
@@ -248,7 +248,7 @@ abstract class AbstractFile implements FileInterface {
        /**
         * Get the MIME type of this file
         *
-        * @return array file information
+        * @return string mime type
         */
        public function getMimeType() {
                return $this->properties['mime_type'] ?: array_pop($this->getStorage()->getFileInfoByIdentifier($this->getIdentifier(), array('mimetype')));
index a0c746a..25f8a3a 100644 (file)
@@ -649,6 +649,7 @@ class LocalDriver extends AbstractHierarchicalFilesystemDriver {
        public function getSpecificFileInformation($fileIdentifier, $containerPath, $property) {
                $identifier = $this->canonicalizeAndCheckFileIdentifier($containerPath . PathUtility::basename($fileIdentifier));
 
+               /** @var FileInfo $fileInfo */
                $fileInfo = GeneralUtility::makeInstance(FileInfo::class, $fileIdentifier);
                switch ($property) {
                        case 'size':
@@ -662,7 +663,7 @@ class LocalDriver extends AbstractHierarchicalFilesystemDriver {
                        case 'name':
                                return PathUtility::basename($fileIdentifier);
                        case 'mimetype':
-                               return $fileInfo->getMimeType();
+                               return (string)$fileInfo->getMimeType();
                        case 'identifier':
                                return $identifier;
                        case 'storage':
index ee5a611..e92d268 100644 (file)
@@ -68,7 +68,7 @@ interface FileInterface extends ResourceInterface {
        /**
         * Get the MIME type of this file
         *
-        * @return array file information
+        * @return string mime type
         */
        public function getMimeType();
 
@@ -107,7 +107,7 @@ interface FileInterface extends ResourceInterface {
        public function setContents($contents);
 
        /****************************************
-        * STORAGE AND MANAGEMENT RELATED METHDOS
+        * STORAGE AND MANAGEMENT RELATED METHODS
         ****************************************/
        /**
         * Deletes this file from its storage. This also means that this object becomes useless.
index 6d4a191..af15db9 100644 (file)
@@ -282,7 +282,7 @@ class FileReference implements FileInterface {
        /**
         * Get the MIME type of this file
         *
-        * @return array file information
+        * @return string mime type
         */
        public function getMimeType() {
                return $this->originalFile->getMimeType();