[BUGFIX] Notice free InlineStackProcessor testing 26/55726/2
authorChristian Kuhn <lolli@schwarzbu.ch>
Thu, 15 Feb 2018 01:56:34 +0000 (02:56 +0100)
committerBenni Mack <benni@typo3.org>
Thu, 15 Feb 2018 12:30:18 +0000 (13:30 +0100)
Change-Id: I77a4782f250a4b37051eb321fd5c6670b4366e24
Resolves: #83908
Releases: master
Reviewed-on: https://review.typo3.org/55726
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Jan Stockfisch <jan.stockfisch@googlemail.com>
Tested-by: Jan Stockfisch <jan.stockfisch@googlemail.com>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/backend/Classes/Form/InlineStackProcessor.php
typo3/sysext/backend/Classes/Form/Utility/FormEngineUtility.php
typo3/sysext/backend/Tests/Unit/Form/InlineStackProcessorTest.php

index 0019919..276664d 100644 (file)
@@ -72,12 +72,12 @@ class InlineStackProcessor
                 if ($i > 0 && $i % 3 == 0) {
                     // Load the TCA configuration of the table field and store it in the stack
                     // @todo: This TCA loading here must fall - config sub-array shouldn't exist at all!
-                    $unstable['config'] = $GLOBALS['TCA'][$unstable['table']]['columns'][$unstable['field']]['config'];
+                    $unstable['config'] = $GLOBALS['TCA'][$unstable['table']]['columns'][$unstable['field']]['config'] ?? [];
                     // Fetch TSconfig:
                     // @todo: aaargs ;)
                     $TSconfig = FormEngineUtility::getTSconfigForTableRow($unstable['table'], ['uid' => $unstable['uid'], 'pid' => $inlineFirstPid], $unstable['field']);
                     // Override TCA field config by TSconfig:
-                    if (!$TSconfig['disabled']) {
+                    if (!isset($TSconfig['disabled']) || !$TSconfig['disabled']) {
                         $unstable['config'] = FormEngineUtility::overrideFieldConf($unstable['config'], $TSconfig);
                     }
 
index 72ed501..703ae42 100644 (file)
@@ -67,8 +67,8 @@ class FormEngineUtility
     {
         if (is_array($TSconfig)) {
             $TSconfig = GeneralUtility::removeDotsFromTS($TSconfig);
-            $type = $fieldConfig['type'];
-            if (is_array($TSconfig['config']) && is_array(static::$allowOverrideMatrix[$type])) {
+            $type = $fieldConfig['type'] ?? '';
+            if (isset($TSconfig['config']) && is_array($TSconfig['config']) && is_array(static::$allowOverrideMatrix[$type])) {
                 // Check if the keys in TSconfig['config'] are allowed to override TCA field config:
                 foreach ($TSconfig['config'] as $key => $_) {
                     if (!in_array($key, static::$allowOverrideMatrix[$type], true)) {
@@ -104,7 +104,7 @@ class FormEngineUtility
         if (!isset($cache[$cacheIdentifier])) {
             $cache[$cacheIdentifier] = BackendUtility::getTCEFORM_TSconfig($table, $row);
         }
-        if ($field) {
+        if ($field && isset($cache[$cacheIdentifier][$field])) {
             return $cache[$cacheIdentifier][$field];
         }
         return $cache[$cacheIdentifier];
index e44b6ec..661d0d6 100644 (file)
@@ -1,4 +1,5 @@
 <?php
+declare(strict_types = 1);
 namespace TYPO3\CMS\Backend\Tests\Unit\Form;
 
 /*
@@ -15,18 +16,14 @@ namespace TYPO3\CMS\Backend\Tests\Unit\Form;
  */
 
 use TYPO3\CMS\Backend\Form\InlineStackProcessor;
+use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
  * Test case
  */
-class InlineStackProcessorTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
+class InlineStackProcessorTest extends UnitTestCase
 {
     /**
-     * Subject is not notice free, disable E_NOTICES
-     */
-    protected static $suppressNotices = true;
-
-    /**
      * @return array
      */
     public function structureStringIsParsedDataProvider()
@@ -39,7 +36,10 @@ class InlineStackProcessorTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes
                         'table' => 'childTable',
                     ],
                 ],
-                []
+                [
+                    'form' => '',
+                    'object' => '',
+                ]
             ],
             'simple 1-level table-uid structure' => [
                 'data-pageId-childTable-childUid',
@@ -49,7 +49,10 @@ class InlineStackProcessorTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes
                         'uid' => 'childUid',
                     ],
                 ],
-                []
+                [
+                    'form' => '',
+                    'object' => '',
+                ]
             ],
             'simple 1-level table-uid-field structure' => [
                 'data-pageId-childTable-childUid-childField',
@@ -60,7 +63,10 @@ class InlineStackProcessorTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes
                         'field' => 'childField',
                     ],
                 ],
-                [],
+                [
+                    'form' => '',
+                    'object' => '',
+                ],
             ],
             'simple 2-level table structure' => [
                 'data-pageId-parentTable-parentUid-parentField-childTable',
@@ -70,7 +76,7 @@ class InlineStackProcessorTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes
                             'table' => 'parentTable',
                             'uid' => 'parentUid',
                             'field' => 'parentField',
-                            'config' => null,
+                            'config' => [],
                         ],
                     ],
                     'unstable' => [
@@ -90,7 +96,7 @@ class InlineStackProcessorTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes
                             'table' => 'parentTable',
                             'uid' => 'parentUid',
                             'field' => 'parentField',
-                            'config' => null,
+                            'config' => [],
                         ],
                     ],
                     'unstable' => [
@@ -111,7 +117,7 @@ class InlineStackProcessorTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes
                             'table' => 'parentTable',
                             'uid' => 'parentUid',
                             'field' => 'parentField',
-                            'config' => null,
+                            'config' => [],
                         ],
                     ],
                     'unstable' => [
@@ -133,13 +139,13 @@ class InlineStackProcessorTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes
                             'table' => 'grandParentTable',
                             'uid' => 'grandParentUid',
                             'field' => 'grandParentField',
-                            'config' => null,
+                            'config' => [],
                         ],
                         [
                             'table' => 'parentTable',
                             'uid' => 'parentUid',
                             'field' => 'parentField',
-                            'config' => null,
+                            'config' => [],
                         ],
                     ],
                     'unstable' => [
@@ -159,13 +165,13 @@ class InlineStackProcessorTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes
                             'table' => 'grandParentTable',
                             'uid' => 'grandParentUid',
                             'field' => 'grandParentField',
-                            'config' => null,
+                            'config' => [],
                         ],
                         [
                             'table' => 'parentTable',
                             'uid' => 'parentUid',
                             'field' => 'parentField',
-                            'config' => null,
+                            'config' => [],
                         ],
                     ],
                     'unstable' => [
@@ -186,13 +192,13 @@ class InlineStackProcessorTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes
                             'table' => 'grandParentTable',
                             'uid' => 'grandParentUid',
                             'field' => 'grandParentField',
-                            'config' => null,
+                            'config' => [],
                         ],
                         [
                             'table' => 'parentTable',
                             'uid' => 'parentUid',
                             'field' => 'parentField',
-                            'config' => null,
+                            'config' => [],
                         ],
                     ],
                     'unstable' => [
@@ -217,13 +223,13 @@ class InlineStackProcessorTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes
                             'flexform' => [
                                 'data', 'sDEF', 'lDEF', 'grandParentFlexForm', 'vDEF',
                             ],
-                            'config' => null,
+                            'config' => [],
                         ],
                         [
                             'table' => 'parentTable',
                             'uid' => 'parentUid',
                             'field' => 'parentField',
-                            'config' => null,
+                            'config' => [],
                         ],
                     ],
                     'unstable' => [