Issue Bug Resolved

#110887Workspace preview fails with TypeError for a move pointer whose live record is deleted

Georg Tiefenbrunn 10/02/26, 11:27 updated 10/08/26, 13:00

Description

Problem

In a workspace, the frontend preview of a page fails with

TypeError
TYPO3\CMS\Core\Domain\Repository\PageRepository::getWorkspaceVersionOfRecord():
Argument #2 ($liveRecord) must be of type array, false given

as soon as a record on that page is a move pointer (t3ver_state=4) whose live record (t3ver_oid) is soft-deleted or does not exist anymore. The same happens in the backend wherever PageRepository::versionOL() is applied, for example for file references resolved through ResourceFactory::getFileReferenceData().

Such move pointers are not created by the DataHandler of TYPO3 14. Deleting a live record discards its workspace versions. They exist in installations upgraded from older TYPO3 versions, where the live record was deleted while a workspace still held a move of it. One broken row is enough to make every page that renders the record (also through a menu or a shortcut) fail in the workspace preview.

Steps to reproduce

  1. Create a page “Target” and a workspace with uid 1.
  2. Create a content element on any page in LIVE and set it to deleted=1.
  3. Insert a move pointer for it in the workspace, for example:
INSERT INTO tt_content (pid, CType, header, colPos, t3ver_wsid, t3ver_oid, t3ver_state)
VALUES (<uid of Target>, 'text', 'Move pointer', 0, 1, <uid of the deleted element>, 4);
  1. Switch to the workspace and open the frontend preview of “Target”.

Expected: the page renders, the orphaned move pointer is skipped.
Actual: TypeError, HTTP 500.

Cause

PageRepository::versionOL() re-reads the live record of an incoming move pointer:

$row = $queryBuilder->select(...$fields)
    ->from($table)
    ->where($queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter((int)$row['t3ver_oid'], Connection::PARAM_INT)))
    ->executeQuery()
    ->fetchAssociative();
...
$wsAlt = $this->getWorkspaceVersionOfRecord($table, $row, $bypassEnableFieldsCheck);

The query keeps the DeletedRestriction, so for a deleted or missing live record fetchAssociative() returns false. Since #108901 (change 90784), getWorkspaceVersionOfRecord() takes the full live record typed as array, so false ends in a TypeError. Before that change, the method received $row['uid'], which only raised a warning for false and then looked up uid 0.

Proposed fix

Return early after the re-read when there is no live record. $row stays false, which the doc comment of versionOL() already defines as “the calling function should act as if the record is forbidden to access”:

if ($row === false) {
    // The live version is deleted, so the move pointer has nothing to point to
    return;
}

Verified on 14.3.7 and main with a functional test in PageRepositoryTest (live record missing, live record soft-deleted). Without the change both cases end in the TypeError, with the change both pass. A patch against main follows on Gerrit (Releases: main, 14.3).

Reviews 2

History 26

  1. Anonymous commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2026-10-08T13:00:12+00:00" > 10/08/26, 13:00 </span>

    Applied in changeset commit:19216e6f2a842d8bc23abfb4d07b656cc0ecae74.