#111624Saving a record without changes in a workspace creates workspace versions of it, its inline children and its translations
Description
Problem
When an editor opens a live record in a workspace and saves it without changing anything, DataHandler creates a workspace version of the record. The workspace module then lists the record as changed, with an empty diff.
The unchanged save does not stop at the record itself:
- Creating the version also versions all inline and file children of the record, at every depth.
- Every inline child that FormEngine submits (for example with its unchanged
hiddentoggle) gets its own version through the same code path. - Saving a default-language record copies its
l10n_mode=excludeandallowLanguageSynchronizationfields into the datamap of each translation (see #86147). In a workspace, each of those translations then gets a version too, together with its inline children.
On publish, all these unchanged copies are swapped into live. Any change made in live to one of these records after the copy was created is overwritten. On a real installation, one unchanged save of a news record with 35 inline content elements and two translations created 120 workspace versions.
Steps to reproduce
- Create a content element of type “Text & Images” with one image in live.
- Switch to a workspace.
- Open the content element and save it without changing anything.
- Open the Workspaces module, or check the database for rows with
t3ver_wsidof that workspace.
Expected: nothing is versioned, because nothing changed.
Actual: the content element and its sys_file_reference both have a workspace version. The Workspaces module lists them as changes.
Reproduced with a functional test on 14.3.12 with only EXT:workspaces loaded:
modifyRecords()withtt_contentand its currentheadervalue creates versions of the content element and of its image reference.modifyRecords()with onlysys_file_referenceandhidden => 0(unchanged) creates a version of the reference.
Cause
In DataHandler::process_datamap(), a live record that may not be edited in the workspace gets its version first:
} elseif (($errorCode = $this->workspaceCannotEditRecord($table, $currentRecord))) {
// Versioning is required and it must be offline version!
// Check if there already is a workspace version
$workspaceVersion = BackendUtility::getWorkspaceVersionOfRecord($this->BE_USER->workspace, $table, $id, 'uid,t3ver_oid');
if ($workspaceVersion) {
$id = $workspaceVersion['uid'];
} elseif ($this->workspaceAllowAutoCreation($table, $id, (int)$currentRecord['pid'])) {
...
$cmd[$table][$id]['version'] = [
'action' => 'new',
'label' => 'Auto-created for WS #' . $this->BE_USER->workspace,
];
$tce->start([], $cmd, $this->BE_USER, $this->referenceIndexUpdater, $this->correlationId);
$tce->process_cmdmap();
Only afterwards are unchanged values removed, and by then they are compared against the new version:
$fieldArray = $this->fillInFieldArray($table, $id, $fieldArray, $incomingFieldArray, (int)$currentRecord['pid'], 'update', $tscPID);
...
$fieldArray = $this->compareFieldArrayWithCurrentAndUnset($table, $id, $fieldArray);
So the decision to create a version never looks at whether anything changed. The same order exists on main and on the 14.3, 13.4 and 12.4 branches.
Proposed fix
Decide whether the submitted values differ from the live record before the version is created, and skip the auto-versioning when nothing differs. Relation fields need care here: checkValue() writes MM relations as a side effect, so the change check must not run the normal processing against the live record.
Reviews 1
History 01
-
Gerrit Code Review pushed patch set 1 for main to change 98075 status
NewUnder Review 11/26/26, 14:58