Skip to content

Commit

Permalink
[BUGFIX] Notice free InlineStackProcessor testing
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
lolli42 authored and bmack committed Feb 15, 2018
1 parent a77b2e0 commit da4db43
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 25 deletions.
4 changes: 2 additions & 2 deletions typo3/sysext/backend/Classes/Form/InlineStackProcessor.php
Expand Up @@ -72,12 +72,12 @@ public function initializeByParsingDomObjectIdString($domObjectId)
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);
}

Expand Down
Expand Up @@ -67,8 +67,8 @@ public static function overrideFieldConf($fieldConfig, $TSconfig)
{
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)) {
Expand Down Expand Up @@ -104,7 +104,7 @@ public static function getTSconfigForTableRow($table, $row, $field = '')
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];
Expand Down
46 changes: 26 additions & 20 deletions typo3/sysext/backend/Tests/Unit/Form/InlineStackProcessorTest.php
@@ -1,4 +1,5 @@
<?php
declare(strict_types = 1);
namespace TYPO3\CMS\Backend\Tests\Unit\Form;

/*
Expand All @@ -15,17 +16,13 @@
*/

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
*/
Expand All @@ -39,7 +36,10 @@ public function structureStringIsParsedDataProvider()
'table' => 'childTable',
],
],
[]
[
'form' => '',
'object' => '',
]
],
'simple 1-level table-uid structure' => [
'data-pageId-childTable-childUid',
Expand All @@ -49,7 +49,10 @@ public function structureStringIsParsedDataProvider()
'uid' => 'childUid',
],
],
[]
[
'form' => '',
'object' => '',
]
],
'simple 1-level table-uid-field structure' => [
'data-pageId-childTable-childUid-childField',
Expand All @@ -60,7 +63,10 @@ public function structureStringIsParsedDataProvider()
'field' => 'childField',
],
],
[],
[
'form' => '',
'object' => '',
],
],
'simple 2-level table structure' => [
'data-pageId-parentTable-parentUid-parentField-childTable',
Expand All @@ -70,7 +76,7 @@ public function structureStringIsParsedDataProvider()
'table' => 'parentTable',
'uid' => 'parentUid',
'field' => 'parentField',
'config' => null,
'config' => [],
],
],
'unstable' => [
Expand All @@ -90,7 +96,7 @@ public function structureStringIsParsedDataProvider()
'table' => 'parentTable',
'uid' => 'parentUid',
'field' => 'parentField',
'config' => null,
'config' => [],
],
],
'unstable' => [
Expand All @@ -111,7 +117,7 @@ public function structureStringIsParsedDataProvider()
'table' => 'parentTable',
'uid' => 'parentUid',
'field' => 'parentField',
'config' => null,
'config' => [],
],
],
'unstable' => [
Expand All @@ -133,13 +139,13 @@ public function structureStringIsParsedDataProvider()
'table' => 'grandParentTable',
'uid' => 'grandParentUid',
'field' => 'grandParentField',
'config' => null,
'config' => [],
],
[
'table' => 'parentTable',
'uid' => 'parentUid',
'field' => 'parentField',
'config' => null,
'config' => [],
],
],
'unstable' => [
Expand All @@ -159,13 +165,13 @@ public function structureStringIsParsedDataProvider()
'table' => 'grandParentTable',
'uid' => 'grandParentUid',
'field' => 'grandParentField',
'config' => null,
'config' => [],
],
[
'table' => 'parentTable',
'uid' => 'parentUid',
'field' => 'parentField',
'config' => null,
'config' => [],
],
],
'unstable' => [
Expand All @@ -186,13 +192,13 @@ public function structureStringIsParsedDataProvider()
'table' => 'grandParentTable',
'uid' => 'grandParentUid',
'field' => 'grandParentField',
'config' => null,
'config' => [],
],
[
'table' => 'parentTable',
'uid' => 'parentUid',
'field' => 'parentField',
'config' => null,
'config' => [],
],
],
'unstable' => [
Expand All @@ -217,13 +223,13 @@ public function structureStringIsParsedDataProvider()
'flexform' => [
'data', 'sDEF', 'lDEF', 'grandParentFlexForm', 'vDEF',
],
'config' => null,
'config' => [],
],
[
'table' => 'parentTable',
'uid' => 'parentUid',
'field' => 'parentField',
'config' => null,
'config' => [],
],
],
'unstable' => [
Expand Down

0 comments on commit da4db43

Please sign in to comment.