Review main Merged

93009[BUGFIX] Handle missing sys_file_reference in ExtendedFileUtility

Rico Sonntag CR +2 V +2 Easy +9 −3 updated 03/02/26, 19:34

Commit message

When deleting a file that has a reference in sys_refindex but the
corresponding sys_file_reference record is missing (e.g. due to
database inconsistency), transformFileReferenceToRecordReference()
returns false from fetchAssociative(). This false value is then
passed to BackendUtility::getRecord() which expects a string,
causing a TypeError (HTTP 503).

This can happen when sys_file_reference records are deleted without
updating sys_refindex, for example during manual database cleanup
or failed transactions.

The fix adds a null return type to
transformFileReferenceToRecordReference() when the sys_file_reference
record is not found, and handles this case in func_delete() by
treating it as a broken reference.

Review

  • Code review CR +2 Done
    • Anja Leichsenring +2
    • Georg Ringer +1
    • Garvin Hicking +1
  • Verified V +2 Done
    • Anja Leichsenring +2
    • Georg Ringer +1
    • Garvin Hicking +1
    • core-ci +1 CI

Issues 1

Files 1

Review log 1115

  1. Rico Sonntag uploaded patch set 1 02/26/26, 11:44

  2. core-ci voted on patch set 1 V +1 02/26/26, 11:56 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/96905

  3. Garvin Hicking commented on patch set 1 02/26/26, 19:38

    Thanks for pushing a patch!

    ExtendedFileUtility.php:559

    when doing a native typehint (should be fine for a protected function) we can omit the phpdoc here.
  4. Rico Sonntag commented on patch set 1 03/02/26, 08:18

    Note: This fix is also needed for the 13.4 branch. The previous backport attempt (change 93015) was abandoned due to an incorrect relation chain. A proper cherry-pick backport should be created after this change is merged.
  5. Rico Sonntag uploaded patch set 2 V +1 03/02/26, 08:31

  6. Rico Sonntag commented on patch set 2 03/02/26, 08:34

    Patch Set 2: Addressed review feedback - removed @return PHPDoc, native ?array typehint is sufficient.
  7. Rico Sonntag commented on patch set 2 03/02/26, 08:36

    ExtendedFileUtility.php Reply

    Done
  8. core-ci voted on patch set 2 V +1 03/02/26, 08:42 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97089

  9. Garvin Hicking updated the commit message in patch set 3 V +1 03/02/26, 10:37

  10. Garvin Hicking commented on patch set 3 CR +1 V +1 03/02/26, 10:40

    I've added this to the commit body: ``` Releases: main, 13.4 ``` This allows us mergers to recognize for which versions a patch is meant.
  11. core-ci voted on patch set 3 V -1 03/02/26, 10:48 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97096

  12. core-ci voted on patch set 3 V +1 03/02/26, 12:47 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/97096

  13. Georg Ringer voted on patch set 3 CR +1 V +1 03/02/26, 19:33

  14. Anja Leichsenring voted on patch set 3 CR +2 V +2 03/02/26, 19:34

  15. Anja Leichsenring merged patch set 4 03/02/26, 19:34