#106655pasteDataMap overridden for each command in DataHandler::process_cmdmap
Description
The `$pasteDataMap` is initialized as array before iterating the whole `$this->cmdmap`. However inside the third nested `foreach`, that iterates over the actual commands array, the `$pasteDataMap` is initialized once more.
This leads to all data set during processing of previous commands, to be lost. Therefore only the data from the last command is available after the whole command map has been processed.
I don’t know, if this is reproducable with a standard TYPO3 installation, because I’m not sure, if there actually is a way to trigger multiple move or copy commands, with additional update data, that would trigger this bug. I found it, with an upgrade wizard, that would use the data handler to save the changes, made to the records. In my case, I was moving multiple content elements into a container element, which get the container parent and colPos data to be updated after the move.
The extra line has been introduced with https://review.typo3.org/c/Packages/TYPO3.CMS/+/86773.
Reviews 1
Related issues 1
History 510
-
Georg Ringer changed Related to #89787 <span data-processor="relativetime" data-value="2025-05-06T09:44:31+00:00" > 05/06/25, 09:44 </span>
-
Gerrit Code Review pushed patch set 1 for main to change 89309 status
NewUnder Review <span data-processor="relativetime" data-value="2025-05-06T10:03:38+00:00" > 05/06/25, 10:03 </span> -
Thorben Nissen changed description <span data-processor="relativetime" data-value="2025-05-07T08:43:04+00:00" > 05/07/25, 08:43 </span>
-
Thorben Nissen commented <span data-processor="relativetime" data-value="2025-05-07T08:44:43+00:00" > 05/07/25, 08:44 </span>
@stefan.buerk Thanks for pointing this out. I tried to improve the description to make it clearer what the actual bug is and how I could reproduce it.
-
Gerrit Code Review pushed patch set 2 for main to change 89309 <span data-processor="relativetime" data-value="2025-05-07T08:47:02+00:00" > 05/07/25, 08:47 </span>
-
Astrid Haubold commented <span data-processor="relativetime" data-value="2025-05-07T18:48:26+00:00" > 05/07/25, 18:48 </span>
Ok, I could reproduce the issue:
Steps to reproduce:
copy 2 simple content elements using DataHandler directly with only one command map.Example code :
$commandMap = [ 'tt_content' => [ 19 => [ 'copy' => [ 'action' => 'paste', 'target' => 170, 'update' => [ 'colPos' => 3 ], ] ], 18 => [ 'copy' => [ 'action' => 'paste', 'target' => 170, 'update' => [ 'colPos' => 3 ], ] ], ], ]; $dataHandler = GeneralUtility::makeInstance(DataHandler::class); $backendUser = $GLOBALS['BE_USER']; if (isset($backendUser->uc['copyLevels'])) { $dataHandler->copyTree = $backendUser->uc['copyLevels']; } $dataHandler->start([], $commandMap); $dataHandler->process_cmdmap();Expected behavior: both elements receive colPos 3.
*Actual behavior:* only the second element receives colPos 3Reason seems to be that the actual update with the values from $pasteDatamap happens in a separate DataHandler call for all records at once after the whole command map has been processed :
$copyTCE = $this->getLocalTCE(); $copyTCE->start($pasteDatamap, [], $this->BE_USER, $this->referenceIndexUpdater); $copyTCE->process_datamap(); -
Gerrit Code Review pushed patch set 3 for main to change 89309 <span data-processor="relativetime" data-value="2026-04-22T06:52:16+00:00" > 04/22/26, 06:52 </span>
-
Gerrit Code Review pushed patch set 4 for main to change 89309 <span data-processor="relativetime" data-value="2026-10-10T07:48:06+00:00" > 10/10/26, 07:48 </span>
-
Gerrit Code Review pushed patch set 5 for main to change 89309 <span data-processor="relativetime" data-value="2026-10-18T12:06:48+00:00" > 10/18/26, 12:06 </span>
@thommyhh Thanks for the report.
However, the repost states “what is wished to do”, but does miss to describe what the “bug“
is and how it can reproduced to verify that a code change does what is intended.