[BUGFIX] FAL FileExtensionFilter raises warning
authorChristian Kuhn <lolli@schwarzbu.ch>
Sun, 2 Sep 2012 22:51:12 +0000 (00:51 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sun, 2 Sep 2012 23:01:29 +0000 (01:01 +0200)
The FileExtensionFilter filterInlineChildren() raises a warning if
$parameters['values'] is not an array. This is triggered by test
areInlineChildrenFilteredWithInvalidParameters() and is sanitized
with this patch.

Change-Id: Ic18575f041eb9e284dc45190d598927c2c0649c5
Resolves: #40543
Releases: 6.0
Reviewed-on: http://review.typo3.org/14298
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/core/Classes/Resource/Filter/FileExtensionFilter.php

index 49e94a3..c048e13 100644 (file)
@@ -65,19 +65,21 @@ class FileExtensionFilter {
                        $this->setDisallowedFileExtensions($parameters['disallowedFileExtensions']);
                }
                $cleanValues = array();
-               foreach ($values as $value) {
-                       if (empty($value)) {
-                               continue;
-                       }
-                       $parts = \TYPO3\CMS\Core\Utility\GeneralUtility::revExplode('_', $value, 2);
-                       $fileReferenceUid = $parts[count($parts) - 1];
-                       $fileReference = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->getFileReferenceObject($fileReferenceUid);
-                       $file = $fileReference->getOriginalFile();
-                       if ($this->isAllowed($file)) {
-                               $cleanValues[] = $value;
-                       } else {
-                               // Remove the erroneously created reference record again
-                               $tceMain->deleteAction('sys_file_reference', $fileReferenceUid);
+               if (is_array($values)) {
+                       foreach ($values as $value) {
+                               if (empty($value)) {
+                                       continue;
+                               }
+                               $parts = \TYPO3\CMS\Core\Utility\GeneralUtility::revExplode('_', $value, 2);
+                               $fileReferenceUid = $parts[count($parts) - 1];
+                               $fileReference = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->getFileReferenceObject($fileReferenceUid);
+                               $file = $fileReference->getOriginalFile();
+                               if ($this->isAllowed($file)) {
+                                       $cleanValues[] = $value;
+                               } else {
+                                       // Remove the erroneously created reference record again
+                                       $tceMain->deleteAction('sys_file_reference', $fileReferenceUid);
+                               }
                        }
                }
                return $cleanValues;