Issue Bug Resolved

#110092Workspaces: infinite loop in CollectionService when records reference each other via FlexForm

Philipp Kitzberger 06/24/26, 08:48 updated 09/02/26, 16:05

Description

Severity: Major — a single circular dependency reachable from the workspace dependency tree makes the whole Workspaces module (and the getWorkspaceInfos AJAX endpoint) crash for that workspace due to memory_limit exhaustion.

RemoteServer::getWorkspaceInfos() → GridDataService::generateGridListFromVersions() → resolveDataArrayDependencies() → CollectionService::process() → CollectionService::resolveDataArrayChildDependencies() walks the workspace dependency graph recursively with no cycle detection. If workspace-versioned records form a circular dependency that is reachable from an outer parent, the recursion never terminates and eventually exhausts memory.

(side note: the user doesn’t see an error message though, due to #107384)

Which relations can form the cycle?

In current main, WorkspaceDependencyReferenceListener marks references as structural workspace dependencies when the field is a FlexFormFieldType, or an inline/file field with a one-to-many/list relationship. Plain top-level group/select/MM references, and therefore CType=shortcut, are not followed. However, references stored inside a FlexForm are indexed under the outer FlexForm field, usually tt_content.pi_flexform, so they are considered dependencies regardless of the concrete inner FlexForm field type.

In older 13.4 code this decision was made by ElementEntityProcessor::createNewDependentElementChildReferenceCallback() / createNewDependentElementParentReferenceCallback(), with the same practical result: FlexForm and inline relations can become workspace dependencies.

Real-world trigger: plugin content elements whose FlexForm contains group, allowed=tt_content target fields pointing at each other, for example a list CE and a detail CE. These are valid scenarios, but the dependency resolver currently assumes an acyclic structure.

Minimal SQL reproduction:

INSERT INTO sys_workspace (uid,pid,title,deleted) VALUES (1,0,'Test',0);

INSERT INTO tt_content (uid,pid,CType,header,t3ver_oid,t3ver_wsid,t3ver_state,t3ver_stage) VALUES
  (1001,1,'text','Live A',0,0,0,0),
  (1002,1,'text','Live B',0,0,0,0),
  (1003,1,'text','Live C outer',0,0,0,0),
  (2001,1,'text','Draft A',1001,1,0,0),
  (2002,1,'text','Draft B',1002,1,0,0),
  (2003,1,'text','Draft C outer',1003,1,0,0);

INSERT INTO sys_refindex (hash,tablename,recuid,field,ref_table,ref_uid,workspace,sorting) VALUES
  (MD5('c-to-a'),'tt_content',2003,'pi_flexform','tt_content',2001,1,0),
  (MD5('a-to-b'),'tt_content',2001,'pi_flexform','tt_content',2002,1,0),
  (MD5('b-to-a'),'tt_content',2002,'pi_flexform','tt_content',2001,1,0);

Then switch to workspace “Test” and open the Workspaces module on a page including pid=1.

Dependency graph: tt_content:2003 → tt_content:2001 → tt_content:2002 → tt_content:2001 → …

*Actual result:*
> PHP Fatal error: Allowed memory size of … bytes exhausted
in typo3/sysext/workspaces/Classes/Service/Dependency/CollectionService.php

Expected result: the Workspaces module should not crash; circular dependency paths should be detected and skipped or otherwise handled gracefully.

Reviews 2

History 39

  1. Philipp Kitzberger commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2026-09-02T16:05:10+00:00" > 09/02/26, 16:05 </span>

    Applied in changeset commit:00ec0b816064131c99bb1cc1b6ecd360682a6748.