[BUGFIX] Check for string before using strlen 92/24092/3
authorMarkus Klein <klein.t3@mfc-linz.at>
Thu, 26 Sep 2013 21:53:12 +0000 (23:53 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Thu, 26 Sep 2013 22:27:22 +0000 (00:27 +0200)
If pi_flexform is converted to an array already, checking via strlen
produces a warning. An additional check via is_string suppresses the
warning.

Resolves: #52091
Resolves: #51684
Releases: 6.2, 6.1, 6.0, 4.7, 4.5
Change-Id: I97c41cdedb1afb28e2a9ca39e1d9cfb3921d9f47
Reviewed-on: https://review.typo3.org/24092
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/extbase/Classes/Configuration/FrontendConfigurationManager.php

index b22a1c3..6e28786 100644 (file)
@@ -154,14 +154,19 @@ class Tx_Extbase_Configuration_FrontendConfigurationManager extends Tx_Extbase_C
         * @return array the framework configuration with overridden data from flexform
         */
        protected function overrideConfigurationFromFlexform(array $frameworkConfiguration) {
-               if (strlen($this->contentObject->data['pi_flexform']) > 0) {
-                       $flexformConfiguration = $this->convertFlexformContentToArray($this->contentObject->data['pi_flexform']);
-
-                       $frameworkConfiguration = $this->mergeConfigurationIntoFrameworkConfiguration($frameworkConfiguration, $flexformConfiguration, 'settings');
-                       $frameworkConfiguration = $this->mergeConfigurationIntoFrameworkConfiguration($frameworkConfiguration, $flexformConfiguration, 'persistence');
-                       $frameworkConfiguration = $this->mergeConfigurationIntoFrameworkConfiguration($frameworkConfiguration, $flexformConfiguration, 'view');
-
-                       $frameworkConfiguration = $this->overrideSwitchableControllerActionsFromFlexform($frameworkConfiguration, $flexformConfiguration);
+               $flexFormConfiguration = $this->contentObject->data['pi_flexform'];
+               if (is_string($flexFormConfiguration)) {
+                       if (strlen($flexFormConfiguration) > 0) {
+                               $flexFormConfiguration = $this->convertFlexformContentToArray($flexFormConfiguration);
+                       } else {
+                               $flexFormConfiguration = array();
+                       }
+               }
+               if (is_array($flexFormConfiguration) && count($flexFormConfiguration)) {
+                       $frameworkConfiguration = $this->mergeConfigurationIntoFrameworkConfiguration($frameworkConfiguration, $flexFormConfiguration, 'settings');
+                       $frameworkConfiguration = $this->mergeConfigurationIntoFrameworkConfiguration($frameworkConfiguration, $flexFormConfiguration, 'persistence');
+                       $frameworkConfiguration = $this->mergeConfigurationIntoFrameworkConfiguration($frameworkConfiguration, $flexFormConfiguration, 'view');
+                       $frameworkConfiguration = $this->overrideSwitchableControllerActionsFromFlexform($frameworkConfiguration, $flexFormConfiguration);
                }
                return $frameworkConfiguration;
        }
@@ -223,7 +228,7 @@ class Tx_Extbase_Configuration_FrontendConfigurationManager extends Tx_Extbase_C
 
                        foreach ($nodeArray as $nodeKey => $nodeValue) {
                                if ($nodeKey === $valuePointer) {
-                                       return $nodeValue;      
+                                       return $nodeValue;
                                }
 
                                if (in_array($nodeKey, array('el', '_arrayContainer'))) {