Project

General

Profile

Actions

Bug #91611

closed

itemProcFunc is failing due to AbstractItemProvider

Added by David Bruchmann almost 4 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Backend API
Target version:
-
Start date:
2020-06-08
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
9
PHP Version:
Tags:
backend, ajax, itemProcFunc, FormDataProvider
Complexity:
Is Regression:
Sprint Focus:

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.

Actions #1

Updated by David Bruchmann almost 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.

Actions #2

Updated by David Bruchmann almost 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.

Actions #3

Updated by Georg Ringer over 3 years ago

  • Status changed from New to Closed

closed as requested

Actions

Also available in: Atom PDF