Issue Bug Closed

#104388Levelmedia + FILES cObject results in fatal error for hidden/deleted file references

Philipp Kitzberger 07/13/24, 07:41 updated 10/07/26, 19:01

Description

This is a follow-up to #82844 because not all issues with hidden file references in workspaces have been resolved for TYPO3 11 and 12.

Problem is having workspace-deleted (t3ver_state=2) or hidden=1 file reference in a draft workspace is throwing an exception when previewing that page in draft preview:

> No file reference (sys_file_reference) was found for given UID: “40907”

That can be reproduced with both renderers cObject FILES and FilesProcessor:

page.10 {
  variables.files = FILES
  variables.files.references.data = levelmedia:-1,slide

  dataProcessing.10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
  dataProcessing.10.references.data = levelmedia:-1,slide
}

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

Files 1

History 8

  1. Philipp Kitzberger changed subject Workspaces + Levelmedia + FILES cObject results still in fatal error Workspaces + Levelmedia + FILES cObject results in fatal error for hidden/deleted file references <span data-processor="relativetime" data-value="2024-07-13T07:42:33+00:00" > 07/13/24, 07:42 </span>

  2. Jo Hasenau commented and changed attached clipboard-202412201604-xt6bz.png subject Workspaces + Levelmedia + FILES cObject results in fatal error for hidden/deleted file references Levelmedia + FILES cObject results in fatal error for hidden/deleted file references status New Accepted <span data-processor="relativetime" data-value="2024-12-20T15:04:43+00:00" > 12/20/24, 15:04 </span>

    I can confirm that behaviour, but not just within Workspaces. As soon as there is a hidden file reference in the list of sys_file_reference IDs, the FilesProcessor will fail with an exception, because the resourceFactory involved via FileCollector will not find any fileReferenceData.

    clipboard-202412201604-xt6bz.png

  3. Benni Mack commented and changed status Accepted Needs Feedback <span data-processor="relativetime" data-value="2025-08-17T13:36:57+00:00" > 08/17/25, 13:36 </span>

    Hey Philipp,

    I cannot reproduce either of these issues in 13+. Can you verify if this problem is solved in v13 with the new RootlineUtility SQL queries?

  4. Philipp Kitzberger commented <span data-processor="relativetime" data-value="2025-08-25T11:04:52+00:00" > 08/25/25, 11:04 </span>

    @benni, with TYPO3 13 I don’t see any “levelmedia images” in FE when switching to a workspace at all!

    I’ve checked that there’s entries in the ref index (necessary for v13 to work with levelmedia):

    SELECT tablename,recuid,field,workspace,ref_table,ref_uid,hidden,ref_hidden
    FROM sys_refindex WHERE tablename='pages' AND field='media' AND recuid IN (10425,13388);
    +-----------+--------+-------+-----------+--------------------+---------+--------+------------+
    | tablename | recuid | field | workspace | ref_table          | ref_uid | hidden | ref_hidden |
    +-----------+--------+-------+-----------+--------------------+---------+--------+------------+
    | pages     |  10425 | media |         0 | sys_file_reference |    8942 |      0 |          0 |
    | pages     |  13388 | media |         1 | sys_file_reference |   29254 |      0 |          0 |
    +-----------+--------+-------+-----------+--------------------+---------+--------+------------+

    10425 is the page in live workspace, 13388 in draft.

    It doesn’t seem to be related to the FilesProcessor though. This is already empty when on a draft WS:

        xxx = TEXT
        xxx.data = levelmedia:-1
  5. Vladimir Falcon commented and changed PHP Version 8.3 <span data-processor="relativetime" data-value="2025-10-13T10:30:08+00:00" > 10/13/25, 10:30 </span>

    I was able to reproduce this error without the Workspaces as well, while upgrading ein System from TYPO3 V12 with an outdated sys_refindex table to V13.

    Reproduction steps:

    - Upgrade from a V12 System with an outdated sys_refindex table and execute all upgrade scripts.
    - Call any sub-page containing inheriting a file from a parent page `levelmedia:-1,slide`

    The error is automatically fixed after executing `referenceindex:update`

  6. Georg Ringer commented and changed status Needs Feedback Closed <span data-processor="relativetime" data-value="2026-10-07T19:01:11+00:00" > 10/07/26, 19:01 </span>

    I could not reproduce this on main (15.0-dev).

    Setup: a page with three file references in media (one visible, one hidden, one visible), rendered with FILES and references.data = levelmedia:-1,slide. Additionally a workspace version of the page with a delete placeholder (t3ver_state=2) for one of the visible references.

    • Live: the hidden reference is skipped, the others are rendered, no exception.
    • Workspace preview: the hidden and the workspace-deleted reference are skipped, the remaining one is rendered, no exception.

    Since v13, RootlineUtility resolves the page’s file references via sys_refindex and already filters hidden records and delete placeholders in the query. Hidden/deleted references therefore never reach FileCollector and the “No file reference (sys_file_reference) was found” exception is not thrown anymore. The same applies to FilesProcessor, which uses the same code path.

    The last comment describes the same exception after an upgrade with an outdated sys_refindex, which is fixed by running referenceindex:update.

    If this still happens on v14+, please provide a reproducible setup including the state of sys_refindex.