[BUGFIX] Use strict comparison for EXT:mediace arrays 45/39645/2
authorBenjamin Mack <benni@typo3.org>
Thu, 21 May 2015 07:04:43 +0000 (15:04 +0800)
committerBenjamin Mack <benni@typo3.org>
Thu, 21 May 2015 12:39:51 +0000 (14:39 +0200)
Due to strict warnings it is not possible to use media content elements
anymore and add a simple youtube video, as a fatal is thrown here.

The change modifies the array check to be stricter.

Resolves: #67074
Releases: master
Change-Id: Ib2dfe78b39e00863b3995b7412333b0260064873
Reviewed-on: http://review.typo3.org/39645
Reviewed-by: Sebastian Michaelsen <michaelsen@t3seo.de>
Tested-by: Sebastian Michaelsen <michaelsen@t3seo.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Cedric Ziel <cedric@cedric-ziel.com>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Stephan GroƟberndt <stephan@grossberndt.de>
Reviewed-by: Benjamin Mack <benni@typo3.org>
Tested-by: Benjamin Mack <benni@typo3.org>
typo3/sysext/mediace/Classes/ContentObject/FlowPlayerContentObject.php
typo3/sysext/mediace/Classes/ContentObject/QuicktimeObjectContentObject.php
typo3/sysext/mediace/Classes/ContentObject/ShockwaveFlashObjectContentObject.php

index 3c3cc30..8a85b3b 100644 (file)
@@ -321,7 +321,7 @@ class FlowPlayerContentObject extends \TYPO3\CMS\Frontend\ContentObject\Abstract
                // Flowplayer config
                $flowplayerVideoConfig = array();
                $flowplayerAudioConfig = array();
-               if (is_array($conf['flashvars.'])) {
+               if (is_array($conf['flashvars.']) && is_array($typeConf['mapping.']['flashvars.'])) {
                        ArrayUtility::remapArrayKeys($conf['flashvars.'], $typeConf['mapping.']['flashvars.']);
                } else {
                        $conf['flashvars.'] = array();
@@ -383,7 +383,7 @@ class FlowPlayerContentObject extends \TYPO3\CMS\Frontend\ContentObject\Abstract
                }
                $flowplayerAudioJsonConfig = str_replace(array('"true"', '"false"'), array('true', 'false'), json_encode($flowplayerAudioConfig));
                // Assemble param tags (required?)
-               if (is_array($conf['params.'])) {
+               if (is_array($conf['params.']) && is_array($typeConf['mapping.']['params.'])) {
                        ArrayUtility::remapArrayKeys($conf['params.'], $typeConf['mapping.']['params.']);
                }
                $videoFlashParams = '';
@@ -400,7 +400,7 @@ class FlowPlayerContentObject extends \TYPO3\CMS\Frontend\ContentObject\Abstract
                $audioFlashParams .= '<param name="flashvars" value=\'config=' . $flowplayerAudioJsonConfig . '\' />' . LF;
                // Assemble audio/video tag attributes
                $attributes = '';
-               if (is_array($conf['attributes.'])) {
+               if (is_array($conf['attributes.']) && is_array($typeConf['attributes.']['params.'])) {
                        ArrayUtility::remapArrayKeys($conf['attributes.'], $typeConf['attributes.']['params.']);
                }
                foreach ($this->html5TagAttributes as $attribute) {
index 1652be7..4570205 100644 (file)
@@ -57,7 +57,7 @@ class QuicktimeObjectContentObject extends \TYPO3\CMS\Frontend\ContentObject\Abs
                $qtObject = 'QTObject' . $replaceElementIdString;
                // Merge with default parameters
                $conf['params.'] = array_merge((array)$typeConf['default.']['params.'], (array)$conf['params.']);
-               if (is_array($conf['params.'])) {
+               if (is_array($conf['params.']) && is_array($typeConf['mapping.']['params.'])) {
                        ArrayUtility::remapArrayKeys($conf['params.'], $typeConf['mapping.']['params.']);
                        foreach ($conf['params.'] as $key => $value) {
                                $params .= $qtObject . '.addParam("' . $key . '", "' . $value . '");' . LF;
index 2fcdaf7..b514f7e 100644 (file)
@@ -86,15 +86,15 @@ class ShockwaveFlashObjectContentObject extends \TYPO3\CMS\Frontend\ContentObjec
                                \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($classRef, $conf, $this);
                        }
                }
-               if (is_array($conf['flashvars.'])) {
+               if (is_array($conf['flashvars.']) && is_array($typeConf['mapping.']['flashvars.'])) {
                        ArrayUtility::remapArrayKeys($conf['flashvars.'], $typeConf['mapping.']['flashvars.']);
                }
                $flashvars = 'var flashvars = ' . (count($conf['flashvars.']) ? json_encode($conf['flashvars.']) : '{}') . ';';
-               if (is_array($conf['params.'])) {
+               if (is_array($conf['params.']) && is_array($typeConf['mapping.']['params.'])) {
                        ArrayUtility::remapArrayKeys($conf['params.'], $typeConf['mapping.']['params.']);
                }
                $params = 'var params = ' . (count($conf['params.']) ? json_encode($conf['params.']) : '{}') . ';';
-               if (is_array($conf['attributes.'])) {
+               if (is_array($conf['attributes.']) && is_array($typeConf['attributes.']['params.'])) {
                        ArrayUtility::remapArrayKeys($conf['attributes.'], $typeConf['attributes.']['params.']);
                }
                $attributes = 'var attributes = ' . (count($conf['attributes.']) ? json_encode($conf['attributes.']) : '{}') . ';';