Project

General

Profile

Actions

Bug #99980

open

DataHandler "processRemapStack" fails settings correct values for e.g. passthrough fields like "l10n_parent" (sets values from "remapAction" before)

Added by Denis Mir over 1 year ago. Updated about 1 year ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
DataHandler aka TCEmain
Target version:
Start date:
2023-02-17
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
11
PHP Version:
8.0
Tags:
Complexity:
medium
Is Regression:
Sprint Focus:

Description

I think we found a major bug in the DataHandlers `processRemapStack` function that needs to be fixed urgently.

            $newValue = null;
            foreach ($this->remapStack as $remapAction) {....}

The "newValue" which gets set as replacement value in the database is defined outside of the loop.

This leads to the case that a remapAction will get the value from the remapAction before.

                // Process the arguments with the defined function:
                if (!empty($remapAction['func'])) {
                    $callable = [$this, $remapAction['func']];
                    if (is_callable($callable)) {
                        $newValue = $callable(...$remapAction['args']);
                    }
                }
                // If array is returned, check for maxitems condition, if string is returned this was already done:
                if (is_array($newValue)) {
                    $newValue = implode(',', $this->checkValue_checkMax($tcaFieldConf, $newValue));
                    // The reference casting is only required if
                    // checkValue_group_select_processDBdata() returns an array
                    $newValue = $this->castReferenceValue($newValue, $tcaFieldConf, $isNew);
                }

This can happen when both of the conditions above evaluate to false. E.g. for passthrough fields there is no "$remapAction['func']".

This breaks for example the creation of inline records when "allowLanguageSynchronization" is enabled. In this case the "l10n_parent" field which is defined as passthrough gets the count of inline items set instead of the correct parent uid.


Files

image (1).png (33.9 KB) image (1).png Database Denis Mir, 2023-05-09 09:07
image.png (86.1 KB) image.png Backend Denis Mir, 2023-05-09 09:07
Actions

Also available in: Atom PDF