[BUGFIX] FormEngine exception and warning creating new record 17/39017/2
authorChristian Kuhn <lolli@schwarzbu.ch>
Tue, 28 Apr 2015 15:43:56 +0000 (17:43 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Wed, 29 Apr 2015 09:42:00 +0000 (11:42 +0200)
Some extensions like ext:news use ';;;;2-2-2' in TCA showItem which is
actually an invalid syntax. FormEngine detects this and throws an
exception. To mitigate the issue, the exception is commented out for
now and a @todo is added on how this case could be handled later.

Another warning in flex form container / section handling is fixed
with the patch by sanitizing the given row data to an array, which
is not always the case, for example if adding a new record.

Resolves: #66628
Related: #63846
Releases: master
Change-Id: Ib6dcba0c5e2c1dad8c842e99994ab97e456deb41
Reviewed-on: http://review.typo3.org/39017
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/backend/Classes/Form/Container/AbstractContainer.php
typo3/sysext/backend/Classes/Form/Container/FlexFormElementContainer.php

index 5afd4a0..40415cf 100644 (file)
@@ -206,11 +206,17 @@ abstract class AbstractContainer extends AbstractNode {
         */
        protected function explodeSingleFieldShowItemConfiguration($field) {
                $fieldArray = GeneralUtility::trimExplode(';', $field);
+               /**
+                * @todo: In general, fieldName must always be given, that is why this exception would be useful.
+                * @todo: But in older versions there was a fifth parameter and settings like ';;;;2-2-2' were used,
+                * @todo; which is obsolete now. Stuff like that could later be parsed-out on a different level of the
+                * @todo: system, the exception could then be commented in again.
                if (empty($fieldArray[0])) {
                        throw new \RuntimeException('Field must not be empty', 1426448465);
                }
+                */
                return array(
-                       'fieldName' => $fieldArray[0],
+                       'fieldName' => $fieldArray[0] ?: '', // This ternary could be removed if above todo is resolved
                        'fieldLabel' => $fieldArray[1] ?: NULL,
                        'paletteName' => $fieldArray[2] ?: NULL,
                        'fieldExtra' => $fieldArray[3] ?: NULL,
index a2b4dc5..e6b7316 100644 (file)
@@ -75,7 +75,7 @@ class FlexFormElementContainer extends AbstractContainer {
 
                                $options = $this->globalOptions;
                                $options['flexFormDataStructureArray'] = $flexFormFieldArray['el'];
-                               $options['flexFormRowData'] = $flexFormRowData[$flexFormFieldName]['el'];
+                               $options['flexFormRowData'] = is_array($flexFormRowData[$flexFormFieldName]['el']) ? $flexFormRowData[$flexFormFieldName]['el'] : array();
                                $options['flexFormSectionType'] = $flexFormFieldName;
                                $options['flexFormSectionTitle'] = $sectionTitle;
                                /** @var FlexFormSectionContainer $sectionContainer */