#111009Native "discard" command breaks workspace dependency resolution
Description
Since #107533, workspace records can be discarded with the native DataHandler command discard:
$commandMap['tt_content'][$versionedUid]['discard'] = true;
The dependency resolution in \TYPO3\CMS\Workspaces\DataHandler\CommandMap::resolveWorkspacesDiscardDependencies() collects these commands, but when it rebuilds the command map it only knows the legacy form (version with action clearWSID / flush). It unsets and re-adds only version entries, built from getCommonClearProperties(), which
only copies an action key. Since a native discard has no action, every element of a dependency structure receives an empty ['version' => []] command, which does nothing.
Impact
- Dependent records are not discarded. Delete a record with an inline child in a
workspace, then discard only the child withdiscard: the parent’s delete
placeholder is left behind in the workspace. The same command map using
version/clearWSIDorflushdiscards the parent as well, so the two
command formats lead to different data. - PHP warnings
Undefined array key "action"inDataHandlerHookand in
DataHandler::process_cmdmap()for each element of the dependency structure.
This also happens when the requested record itself is part of the structure. processCmdmap_*hooks receive an emptyversioncommand for records that
were never requested, and requested records carry bothdiscardand
version.
Discarding the parent still works, because DataHandler::discard() cascades to inline children itself. Only deleted inline structures are affected; for discard, the dependency resolver only follows inline/file/FlexForm relations to delete placeholders.
Steps to reproduce
- In a workspace, delete a record that has inline children (e.g. a hotel with offers from
test_irre_csv). - Discard only the child’s workspace version with
['discard' => true]via DataHandler. - The parent’s delete placeholder still exists; PHP warnings are logged.
- Repeat with
['version' => ['action' => 'flush']]: the parent is discarded too.
Expected behaviour
The native discard command resolves dependencies like the legacy form. Each element keeps the command format it was requested with, dependent elements get the format of the requested element, and other version actions in the same
command map stay untouched.
Reviews 4
Related issues 1
History 38
-
Benni Mack changed description <span data-processor="relativetime" data-value="2026-10-10T09:57:21+00:00" > 10/10/26, 09:57 </span>
-
Gerrit Code Review pushed patch set 1 for main to change 96594 status
NewUnder Review <span data-processor="relativetime" data-value="2026-10-10T10:18:25+00:00" > 10/10/26, 10:18 </span> -
Gerrit Code Review pushed patch set 2 for main to change 96594 <span data-processor="relativetime" data-value="2026-10-10T10:47:36+00:00" > 10/10/26, 10:47 </span>
-
Georg Ringer changed Related to #107533 <span data-processor="relativetime" data-value="2026-10-12T09:06:48+00:00" > 10/12/26, 09:06 </span>
-
Gerrit Code Review pushed patch set 1 for 14.3 to change 96636 <span data-processor="relativetime" data-value="2026-10-12T18:34:08+00:00" > 10/12/26, 18:34 </span>
-
Gerrit Code Review pushed patch set 2 for 14.3 to change 96636 <span data-processor="relativetime" data-value="2026-10-12T18:49:18+00:00" > 10/12/26, 18:49 </span>
-
Gerrit Code Review pushed patch set 3 for main to change 96594 <span data-processor="relativetime" data-value="2026-10-12T19:08:56+00:00" > 10/12/26, 19:08 </span>
-
Benni Mack commented and changed status
Under ReviewResolved done0 %100 % <span data-processor="relativetime" data-value="2026-10-12T19:15:09+00:00" > 10/12/26, 19:15 </span>
Applied in changeset commit:1a080c5f181dccba2d0cd1f2616e60f19cf1ddb1.