#111474DataHandler: inline MM relations are lost when a record gets its workspace version
Description
Problem
When a record with an inline field on an MM table (type => inline with foreign_table and MM) gets its first workspace version, the relations do not reach the version.
- PostgreSQL, two or more children: the first change in a workspace fails with
invalid input syntax for integer: "1,2"and no version is created. This also happens when the record is saved in the backend form, so such a record cannot be edited in a workspace at all. - All DBMS: when the save that creates the version does not carry the field (for example a change of another field through the DataHandler API), the version has no MM rows. The record shows no children in the workspace, already with a single child. When the form is saved afterwards, it saves the empty list, and publishing sets the number of children of the live record to 0 while its MM rows stay.
Group and select fields with MM give the version its own MM rows and the number of children (see DataScenarios/ManyToMany/WorkspacesModify/DataSet/modifyContent.csv).
TYPO3 13.4 has the same code and the same behaviour.
Related to #104510, whose fix turns an empty relation value into 0 for integer columns. The value here is the list of child uids, which that fix does not touch.
Steps to reproduce
- Use the core test extension test_irre_mm: tx_testirremm_hotel.offers is inline with MM tx_testirremm_hotel_offer_rel.
- Create a live hotel with one or two offers.
- Switch to a workspace and change only the title of the hotel through the DataHandler, then save.
- Look at the workspace version of the hotel: it has no rows in tx_testirremm_hotel_offer_rel. On PostgreSQL with two offers the save logs the SQL error instead, also when the hotel is saved in the backend form.
Cause
DataHandler::checkValueForInline() defers the field of a record without a uid (a NEW… id) to the remap stack, also for MM relations. Until then the list of child uids stays in the record, and insertNewCopyVersion() writes it into the integer column that holds the number of children. The automatic versioning runs in a nested process_cmdmap(), which processes the remap stack but never executes dbAnalysisStore afterwards, so the MM rows are never written.
Group and select fields with MM do not defer: checkValue_group_select_processDBdata() keeps the relations in dbAnalysisStore and returns their number, and copyRecord_raw() writes them right after the insert.
Suggested fix
--- a/typo3/sysext/core/Classes/DataHandling/DataHandler.php
+++ b/typo3/sysext/core/Classes/DataHandling/DataHandler.php
@@ -2515,7 +2515,11 @@ class DataHandler
// Example for received data:
// $value = 45,NEW4555fdf59d154,12,123
// We need to decide whether we use the stack or can save the relation directly.
- if (!empty($value) && (str_contains($value, 'NEW') || !MathUtility::canBeInterpretedAsInteger($id))) {
+ // A new record waits for its uid, except with an MM table: checkValue_group_select_processDBdata()
+ // writes those relations once the record exists, and returns their number for the field
+ $waitsForTheUidOfTheRecord = !MathUtility::canBeInterpretedAsInteger($id) && $this->getRelationFieldType($tcaFieldConf) !== 'mm';
+ if (!empty($value) && (str_contains($value, 'NEW') || $waitsForTheUidOfTheRecord)) {Reviews 3
Related issues 4
History 59
-
Gerrit Code Review pushed patch set 1 for main to change 97752 status
NewUnder Review <span data-processor="relativetime" data-value="2026-11-17T14:54:50+00:00" > 11/17/26, 14:54 </span> -
Gerrit Code Review pushed patch set 2 for main to change 97752 <span data-processor="relativetime" data-value="2026-11-18T15:26:53+00:00" > 11/18/26, 15:26 </span>
-
Benni Mack changed Related to #87984 <span data-processor="relativetime" data-value="2026-11-18T17:47:58+00:00" > 11/18/26, 17:47 </span>
-
Benni Mack changed Related to #104510 <span data-processor="relativetime" data-value="2026-11-18T17:48:05+00:00" > 11/18/26, 17:48 </span>
-
Benni Mack changed Related to #108986 <span data-processor="relativetime" data-value="2026-11-18T17:48:12+00:00" > 11/18/26, 17:48 </span>
-
Benni Mack changed Related to #105578 <span data-processor="relativetime" data-value="2026-11-18T17:48:19+00:00" > 11/18/26, 17:48 </span>
-
Gerrit Code Review pushed patch set 3 for main to change 97752 <span data-processor="relativetime" data-value="2026-11-18T18:08:40+00:00" > 11/18/26, 18:08 </span>
-
Gerrit Code Review pushed patch set 1 for 14.3 to change 97798 <span data-processor="relativetime" data-value="2026-11-18T18:25:40+00:00" > 11/18/26, 18:25 </span>
-
Benjamin Kott commented and changed status
Under ReviewResolved done0 %100 % <span data-processor="relativetime" data-value="2026-11-18T19:05:12+00:00" > 11/18/26, 19:05 </span>
Applied in changeset commit:976054576b8cbbfaecb826d06e9b952dea06aa40.