Review main Ready for review

97528[BUGFIX] Keep live uids in relations of new versions

Oli Bartsch CR 0 V 0 Normal +152 −8 updated 11/14/26, 16:20

Commit message

When a record gets its first workspace version, it is copied by
copyRecord_raw() and the copy run ends with remapListedDBRecords().
That method treated the new version like a real copy and replaced
every group, select and category reference to a record copied in the
same run with the uid of the copy. This also happened for references
inside FlexForms. A page whose group field pointed to itself therefore
pointed to its own workspace version, and so did a content element
moved together with the record it references. When only a single
field is changed, for example "hidden" through the page tree context
menu, nothing writes the live uid back. Publishing then writes the
version uid into the live record, and that version is removed
afterwards.

Versions must keep referencing live uids, because overlays are
resolved when records are read. copyRecord_raw() now remembers which
records it copied as a workspace version, and remapListedDBRecords()
skips the uid substitution for them, in plain fields as well as in
FlexForms. For MM relations this means the remapping no longer
rewrites MM rows of versions; the rows written when the version is
created are not changed. The translation origin pointer is still
remapped as before, #106915 deals with it.
Normal copies, including copies inside a workspace, still remap their
references to the copied records.

Test this change

Run a command in your clone of the TYPO3 Core. Then try what the change does and vote on Verified in Gerrit. How to review a patch

Check out patch set 2
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/28/97528/2 && git checkout FETCH_HEAD
Cherry-pick onto main
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/28/97528/2 && git cherry-pick FETCH_HEAD

Review

  • Code review CR 0 Needs a vote
  • Verified V 0 Needs a vote
    • core-ci +1 CI

Merge conflicts 25

Issues 3

Files 8

Review log 57

  1. Oli Bartsch uploaded patch set 1 11/10/26, 22:49

  2. core-ci voted on patch set 1 V +1 11/10/26, 23:06 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/113995

  3. Oliver Klee voted on patch set 1 V +1 11/11/26, 08:40

  4. Benni Mack commented on patch set 1 11/12/26, 20:57

    DataHandler.php:6814

    This comment (and the commit message) treats a version's l10n_parent pointing to the parent's version uid as intended. #106915 / 96331 changes exactly that to the live uid. Can we align the two? If 96331 goes first, this exception can go. Otherwise please reword the comment and add Related: #106915.

    DataHandler.php:6816

    Could you put $this->BE_USER->workspace > 0 && in front? Live copies can't produce versions, and this saves one SELECT per copied record with relation fields.

    DataHandler.php:6849

    The flex branch still calls remapListedDBRecords_procDBRefs() without the flag, so a group or select field inside a FlexForm on a version is still remapped. Please pass $remapCopiedUids through there as well.
  5. Oli Bartsch uploaded patch set 2 V +1 11/14/26, 16:08

  6. Oli Bartsch commented on patch set 2 11/14/26, 16:11

    DataHandler.php:6814 Reply

    Kept on purpose until 96331. Without it a lot of workspace tests fail, exactly the CSVs 96331 rewrites. Comment reworded and Related: #106915 added. Whichever lands second drops/keeps the exception.

    DataHandler.php:6816 Reply

    Replaced the lookup entirely. copyRecord_raw() marks the version uid when versionizeRecord() passes t3ver_oid, remapListedDBRecords() checks that marker.

    DataHandler.php:6849 Reply

    Done
  7. core-ci voted on patch set 2 V +1 11/14/26, 16:20 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/114465