Actions
Bug #90925
closedIncorrectly selected items in MM select fields
Start date:
2020-04-01
Due date:
% Done:
100%
Estimated time:
TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
Is Regression:
Yes
Sprint Focus:
Description
After updating from TYPO3 9.5.14 to 9.5.15 there are incorrectly selected items in some of my backend select fields with MM relations.
I can reproduce this behaviour in 9.5.14 with a patch of change "2020-03-06 622e1a3dcd [BUGFIX] Reorder processing of TCA select items again".
The function call in TcaSelectItems.php line 87:
$result['databaseRow'][$fieldName] = $this->processSelectFieldValue($result, $fieldName, $staticValues);
changed there to:
$result['databaseRow'][$fieldName] = $this->processSelectFieldValue($result, $fieldName, $itemArray);
$staticValues is empty, but $itemArray is filled in my case with all available items - and compared in AbstractDataProvider to the $currentDatabaseValueArray which holds the number of relations for MM select fields.
protected function processSelectFieldValue(array $result, $fieldName, array $staticValues)
{
$fieldConfig = $result['processedTca']['columns'][$fieldName];
$currentDatabaseValueArray = array_key_exists($fieldName, $result['databaseRow']) ? $result['databaseRow'][$fieldName] : [];
$newDatabaseValueArray = [];
// Add all values that were defined by static methods and do not come from the relation
// e.g. TCA, TSconfig, itemProcFunc etc.
foreach ($currentDatabaseValueArray as $value) {
if (isset($staticValues[$value])) {
$newDatabaseValueArray[] = $value;
}
}
As a result the MM select field gets as additional item the record with uid == number of relations, which can not be deleted.
Actions