Actions
Bug #85531
closedError with "select" and "group" field using l10n_display "defaultAsReadonly"
Status:
Closed
Priority:
Must have
Assignee:
-
Category:
FormEngine aka TCEforms
Target version:
-
Start date:
2018-07-10
Due date:
% Done:
0%
Estimated time:
TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
Is Regression:
Yes
Sprint Focus:
Description
When editing a translated record which contains a group
field whose l10n_display
is configured as defaultAsReadonly
an exception occurs:
#1476107295: PHP Warning: count(): Parameter must be an array or an object that implements Countable in /.../typo3/sysext/backend/Classes/Form/Element/GroupElement.php line 120 (More information) TYPO3\CMS\Core\Error\Exception thrown in file /.../typo3/sysext/core/Classes/Error/ErrorHandler.php in line 115. 38 TYPO3\CMS\Core\Error\ErrorHandler::handleError(2, "count(): Parameter must be an array or an object that implements Countable", "/.../typo3/sysext/backend/Classes/Form/Element/GroupElement.php", 120, array) 37 count("1") /.../typo3/sysext/backend/Classes/Form/Element/GroupElement.php: 00118: 00119: $selectedItems = $parameterArray['itemFormElValue']; 00120: $selectedItemsCount = count($selectedItems); 00121: 00122: $maxItems = $config['maxitems'];
A similar error occurs a little later on TYPO3v8:
#1476107295: PHP Warning: Invalid argument supplied for foreach() in /.../typo3/sysext/backend/Classes/Form/Element/GroupElement.php line 158 (More information) TYPO3\CMS\Core\Error\Exception thrown in file /.../typo3/sysext/core/Classes/Error/ErrorHandler.php in line 107. 17 TYPO3\CMS\Core\Error\ErrorHandler::handleError(2, "Invalid argument supplied for foreach()", "/.../typo3/sysext/backend/Classes/Form/Element/GroupElement.php", 158, array) /.../typo3/sysext/backend/Classes/Form/Element/GroupElement.php: 00156: } 00157: } elseif ($internalType === 'db') { 00158: foreach ($selectedItems as $selectedItem) { 00159: $tableWithUid = $selectedItem['table'] . '_' . $selectedItem['uid']; 00160: $listOfSelectedValues[] = $tableWithUid;
The code here expects an array but gets an integer (number of related records) instead.
This is triggered by the SingleFieldContainer
which replaces the databaseRow
value prepared by TcaGroup
with the raw value from defaultLanguageRow
in case l10n_display
is set to defaultAsReadonly
.
This error does not occur on TYPO3v7 but the field is empty instead there.
This can be reproduced e.g. with the following steps:
- Add
'l10n_display' => 'defaultAsReadonly'
to$GLOBALS['TCA']['tt_content']['columns']['file_collections']
- Create an empty file collection on a page
- Add a File links content element to that page and select the created file collection
- Translate the page and the File links content element
- Edit the translated File links content element and see the error
Actions