[BUGFIX] Nested flexforms no longer throw exception 75/32675/2
authorThomas Christiansen <thomas.christiansen@e-net.info>
Thu, 5 Jun 2014 13:33:53 +0000 (15:33 +0200)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Tue, 9 Sep 2014 11:06:24 +0000 (13:06 +0200)
This patch prevents nested flexforms from throwing
an exception on saving or opening the record.

Resolves: #59368
Releases: master, 6.2
Change-Id: Iadeeecc3aef92b8bcc4f7fe4e22882d924f10a50
Reviewed-on: http://review.typo3.org/32675
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
typo3/sysext/backend/Classes/Form/DataPreprocessor.php
typo3/sysext/core/Classes/Database/ReferenceIndex.php

index 04f486f..0f07fd8 100644 (file)
@@ -438,7 +438,11 @@ class DataPreprocessor {
         */
        public function renderRecord_flexProc($data, $fieldConfig, $TSconfig, $table, $row, $field) {
                // Convert the XML data to PHP array:
-               $currentValueArray = GeneralUtility::xml2array($data);
+               if (!is_array($data)) {
+                       $currentValueArray = GeneralUtility::xml2array($data);
+               } else {
+                       $currentValueArray = $data;
+               }
                if (is_array($currentValueArray)) {
                        // Get current value array:
                        $dataStructArray = BackendUtility::getFlexFormDS($fieldConfig['config'], $row, $table, $field);
index db28300..7700a65 100644 (file)
@@ -497,7 +497,7 @@ class ReferenceIndex {
                        $this->temp_flexRelations['db'][$structurePath] = $resultsFromDatabase;
                }
                // Soft References:
-               if (strlen($dataValue) && ($softRefs = BackendUtility::explodeSoftRefParserList($dsConf['softref']))) {
+               if ((is_array($dataValue) || strlen($dataValue)) && $softRefs = BackendUtility::explodeSoftRefParserList($dsConf['softref'])) {
                        $softRefValue = $dataValue;
                        foreach ($softRefs as $spKey => $spParams) {
                                $softRefObj = BackendUtility::softRefParserObj($spKey);