Review main Abandoned

94311[BUGFIX] Respect pid=0 and rooLevelRestriction in DH::versionizeRecord

Andreas Häfner CR 0 V 0 Easy +33 −2 updated 07/16/26, 14:03

Commit message

DataHandler in versionizeRecord() does not respect file metadata
which are stored on `pid=0`

sys_file_metadata wit pid=0 causes an empty page record which gets
passed down to the BE_user `isInWebMount()` throwing an exception
because no `uid` is provided in the empty array.

This change modifies versionizeRecord() to reintroduce checks
for the TCA option `ignoreRootLevelRestriction` when record pid
is zero, not calling `isInWebMount()` with an empty page record.

Copied condition from DataHandler::localize() which handles same
case.

\TYPO3\CMS\Workspaces\Hook\DataHandlerHook::version_setStage()
has the same issue. So boilerplate is added there too.

Review

  • Code review CR 0
  • Verified V 0
    • core-ci +1 CI

Issues 2

Files 2

Review log 911

  1. Andreas Häfner uploaded patch set 1 06/04/26, 08:10

  2. core-ci voted on patch set 1 V +1 06/04/26, 08:17 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/102939

  3. Andreas Häfner uploaded patch set 2 V +1 06/04/26, 08:50

  4. core-ci voted on patch set 2 V +1 06/04/26, 09:02 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/102940

  5. Andreas Häfner commented on patch set 2 06/04/26, 09:02

    Unresolved

    These boilerplate constructs to guard against page=0 and empty page-records are somehow ugly, but widespread in DataHandler. Is maybe a more general solution possible to handle records on RootPage?
  6. Andreas Häfner commented on patch set 2 06/04/26, 09:47

    Unresolved

    A possible approach could be, to populate a default page record array in case pid=0 so that BackendUserAuthentication::isInWebMount and other can work with usable data. That way rootPage could be handled as each other page without extra handling.
  7. Benni Mack commented on patch set 2 06/11/26, 07:47

  8. Andreas Häfner commented on patch set 2 06/11/26, 08:09

    Yes. Seems to solve same issue
  9. Oliver Hader commented on patch set 2 06/24/26, 18:22

    Unresolved

    This patch and the referenced patch actually would fix the problem and tackle the right locations in the code. However, I tried to take it a step further - basically to avoid checking for the root-level restriction in the schema again and again, but to make that explicit and centralize the handling. So, I added a new enum case `VirtualRecord::RootPage`. → see it in action at https://review.typo3.org/c/Packages/TYPO3.CMS/+/94573
  10. Andreas Häfner commented on patch set 2 06/25/26, 05:27

    Unresolved

    I Like the approach with VirtualRecord.
  11. Benni Mack abandoned the change 07/16/26, 14:03

    fixed in latest versions.