96830[BUGFIX] Avoid duplicate MM rows when copying both relation sides
Commit message
Review
-
Code review CR +2 Done
- Benni Mack +2
- Oli Bartsch +1
-
Verified V +2 Done
- Benni Mack +2
- Oli Bartsch +1
- core-ci +1 CI
Issues 2
Files 4
- typo3/sysext/core/Classes/DataHandling/DataHandler.php2+17 −1
- typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/DataSet/CopyPageWithBidirectionalMM/CopyPageResult.csvnew+22 −0
- typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/DataSet/CopyPageWithBidirectionalMM/Import.csvnew+17 −0
- typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/CopyPageWithBidirectionalMMTest.phpnew+50 −0
Review log 79
-
Benni Mack uploaded patch set 1 10/18/26, 16:17
-
core-ci voted on patch set 1 V +1 10/18/26, 16:28 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/111542
-
Benni Mack marked it ready for review 10/23/26, 06:36
-
Oli Bartsch commented on patch set 1 10/23/26, 08:20
I ran into the same issue via #109847 and pushed https://review.typo3.org/c/Packages/TYPO3.CMS/+/96966, which fixes it in the same method. Yours is older and covers the older issue, so I'll abandon mine in favour of this one. One difference between the two approaches is described inline; apart from that, the result is the same for the reported case.DataHandler.php:7040This drops the item for every MM field, including fields with "multiple" enabled. For those, DefaultTcaSchema creates the MM table with its own uid primary key (see the "multiple" handling around line 1122), so repeated relations are allowed and no unique constraint violation can occur. If a record is intentionally related to both the original and the copy, this would silently remove a relation. Limiting it to fields without "multiple" would keep the fix to the case that actually breaks: ```php if (!empty($conf['MM']) && !($conf['multiple'] ?? false) && isset($existingItems[$v['table'] . ':' . $mapID])) { ``` -
Oli Bartsch uploaded patch set 2
V +110/23/26, 08:29 -
Oli Bartsch commented on patch set 2 CR +1 V +1 10/23/26, 08:30
Reply
DoneDataHandler.php:7040ReplyDone -
core-ci voted on patch set 2 V +1 10/23/26, 08:58 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/112245
-
Benni Mack voted on patch set 2 CR +2 V +2 10/23/26, 08:58
-
Benni Mack merged patch set 3 10/23/26, 08:58