Bug #91611
closeditemProcFunc is failing due to AbstractItemProvider
0%
Description
in
TYPO3\CMS\Backend\Form\FormDataProvider\AbstractItemProvider::resolveItemProcessorFunction
the wrong results are returned. I checked it in TYPO3 9.5 but verified the code of version 10.4 too and it is at least fundamentally the same:
Here the individual function is called with prepared $processorParameters:
$processorParameters = [ // Function manipulates $items directly and return nothing 'items' => &$items, 'config' => $config, 'TSconfig' => $pageTsProcessorParameters, 'table' => $table, 'row' => $result['databaseRow'], 'field' => $fieldName, ]; if (!empty($result['flexParentDatabaseRow'])) { $processorParameters['flexParentDatabaseRow'] = $result['flexParentDatabaseRow']; } try { GeneralUtility::callUserFunction($config['itemsProcFunc'], $processorParameters, $this); } catch (\Exception $exception) { ... }
Afterwards `$items` is returned.
The fault is that $items is not the same like $processorParameters['items'] and $items is un-altered still the old data.
I changed the last method-line to
return $processorParameters['items'];
and got the expected results.
Updated by David Bruchmann over 4 years ago
Actually I don't know why it was expected to work or the fault never remarked before.
I have a data-array for select-fields like this:
$items = [ [title1, uid1, value1], [title2, uid2, value2], [title3, uid3, value3], ];
Challenge was to reduce the data and return a limited amount of sub-arrays.
It might be possible that itemProcFunc works for other challenges, for this not.
Updated by David Bruchmann over 4 years ago
- Target version deleted (
Candidate for patchlevel)
Issue can be closed.
I did unset $processorParameters['items'] before assigning it new and that destroyed the reference.