Issue Bug Under Review

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

Denis Mir 02/17/23, 12:44 updated 11/09/26, 20:55

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.

Reviews 1

Files 2

History 34

  1. Denis Mir commented <span data-processor="relativetime" data-value="2023-02-21T07:15:24+00:00" > 02/21/23, 07:15 </span>

    Just as a note the “checkValueForInternalReferences” method is the reason why the “if (!empty($remapAction[‘func’]))” condition is not being hit.

  2. Denis Mir commented and changed attached image (1).png attached image.png <span data-processor="relativetime" data-value="2023-05-09T09:08:20+00:00" > 05/09/23, 09:08 </span>

    Here is an example which fails due to this bug as well. (manually creating translated items via the DataHandler)

            $dataHandler = GeneralUtility::makeInstance(DataHandler::class);
            $cmd = [];
            $data = [];
    
            $data['tx_user_ext_domain_model_text'] = [
                "NEW6459ee9332753637991034" => [
                    "pid" => 981,
                    "sys_language_uid" => 0,
                    "identifier" => 8514,
                    "label" => "Test A - Language 0"
                ],
                "NEW6459ee944f3f0818025611" => [
                    "pid" => 981,
                    "sys_language_uid" => 1,
                    "identifier" => 8514,
                    "label" => "Test A - Language 1",
                    "l10n_parent" => "NEW6459ee9332753637991034"
                ],
                "NEW6459ee9334c0d549539707" => [
                    "pid" => 981,
                    "sys_language_uid" => 0,
                    "identifier" => 8514,
                    "label" => "Test B - Language 0"
                ],
                "NEW6459ee9451820725382473" => [
                    "pid" => 981,
                    "sys_language_uid" => 1,
                    "identifier" => 8514,
                    "label" => "Test B - Language 1",
                    "l10n_parent" => "NEW6459ee9334c0d549539707"
                ]
            ];
    
            $dataHandler->start($data, $cmd);
            $dataHandler->process_datamap();

    The remapping for the translated items fails due to the passthrough “l10n_parent” field and gets as a value null.

    I have attached the database and backend view after running the data handler.

  3. Filipe DA COSTA commented <span data-processor="relativetime" data-value="2025-07-30T12:06:34+00:00" > 07/30/25, 12:06 </span>

    I’m having the same exact problem with v12.4.34 when using inline records in combination of allowLanguageSynchronization or l10n_mode=>exclude