#107334sys_file_reference pid 0 when adding media on page creation
Description
*Description*
If you link a file in the media field when creating a page, the resulting sys_file_reference record gets pid 0. This means non-admin users are unable to remove it.
*How to reproduce*
- Log in to a TYPO3 13 backend
- Go to the “Page” module
- Right click on an existing page
- Click on “New subpage“
- Input a title
- Go to the “Resources” tab and select a file for the “Media” field
- Save the page
*Expected result*
- pid of the sys_file_reference record is the uid of the new page
- Non-admin user is able to remove the sys_file_reference
*Actual result*
- pid of the sys_file_reference record is 0
- Non-admin user is not able to remove the sys_file_reference
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.
Related issues 1
History 9
-
Rudy Gnodde changed Related to #106569 <span data-processor="relativetime" data-value="2025-08-26T14:19:36+00:00" > 08/26/25, 14:19 </span>
-
Rudy Gnodde commented <span data-processor="relativetime" data-value="2025-08-26T14:46:58+00:00" > 08/26/25, 14:46 </span>
It is not a regression of #106569. The problem occurs in TYPO3\CMS\Backend\Form\Container\FileReferenceContainer::renderFileReferenceHeaderControl().
$calcPerms = new Permission( $backendUser->calcPerms(BackendUtility::readPageAccess( (int)($this->data['parentPageRow']['uid'] ?? 0), $backendUser->getPagePermsClause(Permission::PAGE_SHOW) )) );Because the pid of the sys_file_reference record is 0, $this->data[‘parentPageRow’] is empty and the user does not have access to a page with uid 0.
-
Christian Kuhn commented <span data-processor="relativetime" data-value="2025-08-26T17:34:57+00:00" > 08/26/25, 17:34 </span>
dupe of (and fixed with?) #103092 ?!
-
Christian Kuhn changed Duplicates #103092 <span data-processor="relativetime" data-value="2025-08-26T17:35:15+00:00" > 08/26/25, 17:35 </span>
-
Garvin Hicking changed status
NewNeeds Feedback <span data-processor="relativetime" data-value="2025-08-26T18:34:22+00:00" > 08/26/25, 18:34 </span> -
Rudy Gnodde commented <span data-processor="relativetime" data-value="2025-08-27T06:45:07+00:00" > 08/27/25, 06:45 </span>
Yes, #103092 fixes the pid 0 problem. However, if `security.ignoreRootLevelRestriction` is set in TCA, shouldn’t users be able to remove the sys_file_reference even if pid is 0.
-
Christian Kuhn commented and changed status
Needs FeedbackResolved <span data-processor="relativetime" data-value="2025-08-27T08:12:22+00:00" > 08/27/25, 08:12 </span>Rudy Gnodde wrote in #note-7:
> Yes, #103092 fixes the pid 0 problem. However, if `security.ignoreRootLevelRestriction` is set in TCA, shouldn’t users be able to remove the sys_file_reference even if pid is 0.Thx. I hope it is ok to close here as duplicate.
Unsure about `security.ignoreRootLevelRestriction`, there may be further checks / settings that prevent users from accessing pid 0 in this case. If you have to fix your existing db set, you could do that manually lowlevel (i guess not that many records should be affected?), and you could have a look at ext:dbdoctor which comes with a (relatively early) fixer to move sys_file_reference records to correct pid.
-
Benni Mack changed status
ResolvedClosed <span data-processor="relativetime" data-value="2025-12-02T13:58:18+00:00" > 12/02/25, 13:58 </span>
I just noticed `$GLOBALS[‘TCA’][‘sys_file_reference’][‘ctrl’][‘security’][‘ignoreRootLevelRestriction’]` is set to `true`, so this could also be a bug where the delete button isn’t shown to non-admin users even though `ignoreRootLevelRestriction` is set to `true`. Possibly a regression of #106569