#107432RuntimeException when creating new workspace version of sys_file_metadata records as editor
Description
Hello,
when creating a new workspace version of a sys_file_metadata record as a backend editor, TYPO3 throws a RuntimeException.
This happens because TYPO3 tries to check page permissions for the record. During this process, TYPO3 extracts the pid of the record and fetches the corresponding pages record from the database. However, sys_file_metadata records always have pid = 0. As a result, the database query for the pages record returns an empty array. Since this array does not contain a pid field, TYPO3 raises an exception.
Steps to reproduce
- Log in to the TYPO3 backend as an editor (non-admin). Editor has no LIVE workspace access and is assigned as valid user to a workspace.
- Navigate to the Filelist module.
- Select a file and open its metadata (from table sys_file_metadata).
- Change a value like title or description
- Save the records (which will try to create a new version of the metadata record).
Expected behavior
Creating a new workspace version of sys_file_metadata should work without errors. Since metadata records always have pid = 0, TYPO3 should handle this case gracefully without attempting to fetch a related pages record.
Actual behavior
TYPO3 throws the following exception:
(1/1) #1578950324 RuntimeException The given page record is invalid. Missing uid. in /vendor/typo3/cms-core/Classes/Authentication/BackendUserAuthentication.php line 329
Stack trace excerpt:
at TYPO3\CMS\Core\Authentication\BackendUserAuthentication->isInWebMount(array()) in /vendor/typo3/cms-core/Classes/DataHandling/DataHandler.php line 7620 ... at TYPO3\CMS\Core\DataHandling\DataHandler->hasPagePermission(1, array())
Additional information
The issue only occurs for editors (non-admin users).
sys_file_metadata records are always stored on pid = 0, which makes the page permission check invalid in this context.
As a result, TYPO3 receives an empty array instead of a valid pages record, leading to the RuntimeException.
Reviews 12
- 13.4 97239[BUGFIX] Let editors publish new root-level records
- 14.3 97238[BUGFIX] Let editors publish new root-level records
- main 97178[BUGFIX] Let editors publish new root-level records
- 13.4 95166[BUGFIX] Defer BE_USER check in DataHandler::hasPageContextPermission
- 14.3 95165[BUGFIX] Defer BE_USER check in DataHandler::hasPageContextPermission
- main 94880[BUGFIX] Defer BE_USER check in DataHandler::hasPageContextPermission
- main 95116[BUGFIX] Honor bypassAccessCheckForRecords without uid
- 13.4 94568[BUGFIX] Respect pid=0 and rooLevelRestriction in DH::versionizeRecord
- main 94311[BUGFIX] Respect pid=0 and rooLevelRestriction in DH::versionizeRecord
- 13.4 94633[BUGFIX] Refine exceptions to root-level restriction in DataHandler
- 14.3 94774[BUGFIX] Refine exceptions to root-level restriction in DataHandler
- main 94573[BUGFIX] Refine exceptions to root-level restriction in DataHandler
Related issues 8
- Bug #106569Translation of file metadata not possible as editor
- Bug #106928Exception when an editor tries to delete file metadate translation
- Bug #107103\RuntimeException is thrown, when an editor tries to delete a redirect
- Bug #107379Editing of file metadata in workspace not possible as editor
- Bug #107905User can not create versioned sys_file_metadata from Workspaces
- Bug #108723Workspace preview actions interrupted by elements on root page
- Bug #110242DataHandler::hasPageContextPermission() denies admin / bypassAccessCheckForRecords when BE user uid is 0
- Bug #111259Non-admin editors cannot publish new records on root level (pid=0) in a workspace, e.g. sys_file_metadata placeholders