Project

General

Profile

Bug #85531

Updated by Mathias Brodala almost 6 years ago

When editing a translated record which contains a @group@ field whose @l10n_display@ is configured as @defaultAsReadonly@ an exception occurs in TYPO3v8: occurs: 

 <pre> 
 #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; 
 </pre> 

 This fails even earlier on the latest master (thus upcoming v9): 

 <pre> 
 #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']; 
 </pre> 

 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@.

Back