#110585Record history rollback treats moved records as deleted
Description
\TYPO3\CMS\Backend\History\RecordHistory::getDiff() builds the insertsDeletes map that drives the rollback preview and RecordHistoryRollback::performRollback(). It branches on every action type that is not ACTION_MODIFY, then increments when the entry carries
@action = ‘insert’@ and decrements otherwise.
prepareEventDataFromQueryBuilder() only sets action for ACTION_ADD and ACTION_UNDELETE (“insert”), ACTION_DELETE (“delete”) and ACTION_PUBLISH (“publish”). So ACTION_MOVE and ACTION_STAGECHANGE carry no action at all, and ACTION_PUBLISH carries a value that is not insert — all three decrement and are therefore counted as deletions.
Reproduced against the class:
changelog: [MOVE, MODIFY] => insertsDeletes: ['tt_content:5' => -1] changelog: [PUBLISH, STAGECHANGE] => insertsDeletes: ['tt_content:5' => -2]
Effects:
- A record that was only moved renders the preview text “The record has been deleted and will be restored again with the rollback”, and
performRollback()issues anundeletecommand for a record that was never deleted. - Two such entries sum to
-2, which is handled neither by the preview (=== -1) nor byperformRollback()(=== 1/=== -1). The entry is silently dropped, so a real delete next to a move can become unrecoverable through the UI. - Inside a workspace, where
ACTION_STAGECHANGEentries are visible, nearly every rollback preview is skewed.
Expected: only ACTION_ADD and ACTION_UNDELETE count as an insert, only ACTION_DELETE as a delete. Move, stage change and publish must not enter
@insertsDeletes@ at all.
There is currently no functional test for getDiff() or performRollback(); the fix should add one covering all seven action types.
Reviews 3
History 14
-
Gerrit Code Review pushed patch set 1 for main to change 95530 status
NewUnder Review <span data-processor="relativetime" data-value="2026-09-01T19:43:40+00:00" > 09/01/26, 19:43 </span> -
Gerrit Code Review pushed patch set 1 for 14.3 to change 95533 <span data-processor="relativetime" data-value="2026-09-01T20:57:54+00:00" > 09/01/26, 20:57 </span>
-
Gerrit Code Review pushed patch set 1 for 13.4 to change 95534 <span data-processor="relativetime" data-value="2026-09-01T20:58:00+00:00" > 09/01/26, 20:58 </span>
-
Benni Mack commented and changed status
Under ReviewResolved done0 %100 % <span data-processor="relativetime" data-value="2026-09-01T21:05:08+00:00" > 09/01/26, 21:05 </span>
Applied in changeset commit:e260a60375aab40e249a0417c26264e9e90bd8b5.