Issue Bug Resolved

#111009Native "discard" command breaks workspace dependency resolution

Benni Mack 10/10/26, 09:56 updated 10/12/26, 19:15

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 with discard: the parent’s delete
    placeholder is left behind in the workspace. The same command map using
    version / clearWSID or flush discards the parent as well, so the two
    command formats lead to different data.
  • PHP warnings Undefined array key "action" in DataHandlerHook and 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 empty version command for records that
    were never requested, and requested records carry both discard and
    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

  1. In a workspace, delete a record that has inline children (e.g. a hotel with offers from test_irre_csv).
  2. Discard only the child’s workspace version with ['discard' => true] via DataHandler.
  3. The parent’s delete placeholder still exists; PHP warnings are logged.
  4. 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

History 38

  1. Benni Mack commented and changed status Under Review Resolved done 0 % 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.