Issue Bug Resolved

#109457History/undo list of changes sorted in the wrong way

Stefan Terborg 04/01/26, 11:08 updated 09/30/26, 09:15

Description

When deleting a page with many subelements (tt_content, sys_file_reference, …) the list of changes in the history/undo function is wrong.

The list is supposed to reflect the order of changes, having the last element in the list to be the one reverting ALL listed changes.
However, the list is sorted by tstamp which is equal for all elements, when deletion happens in one go.
The result is a list of randomly sorted elements, while it should be sorted by uid DESC, since the element with the lowest uid reverts all other changes of the same record.

Sorting happens here: https://github.com/TYPO3/typo3/blob/13.4/typo3/sysext/backend/Classes/History/RecordHistory.php#L234

TYPO3 13.4.25
PHP 8.4

How to reproduce: create a page with several content elements and files on it, then delete the page. Restore page with history/undo. Examine list of changes and preview of revert process.

Expected result: last item in the list of changes should revert ALL changes.

Experienced result: the item to revert ALL changes is located at a random position in the list.

Proposed fix: Sort by tstamp, then uid DESC

Reviews 2

History 13

  1. Wouter Wolters commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2026-09-30T09:15:10+00:00" > 09/30/26, 09:15 </span>

    Applied in changeset commit:062be2a624af79ad036a4053ed7f6eb801835e04.