Bug #104496
closedPHP warnings with broken backend shortcuts
100%
Description
After migrating from PHP 7.4 to 8.2 I found some PHP warning messages in my logs, which were caused by backend shortcuts pointing to non-existent records:
Core: Error handler (BE): PHP Warning: Undefined array key "recordid" in /.../typo3/sysext/backend/Classes/Backend/Shortcut/ShortcutRepository.php line 640 Core: Error handler (BE): PHP Warning: Undefined array key "table" in /.../typo3/sysext/backend/Classes/Backend/Shortcut/ShortcutRepository.php line 639 Core: Error handler (BE): PHP Warning: Undefined array key "edit" in /.../typo3/sysext/backend/Classes/Backend/Shortcut/ShortcutRepository.php line 478
All three messages were caused by the same broken shortcut. After deleting the broken shortcut the error messages didn't occur again.
No errors were visible using the live preset, though.
It's worse when using the debug preset, because the user can't even log into the backend.
The shortcut causing this had uid=433. uid=306 doesn't make sense, either, but it's not visible in the shortcut dropdown and does not produce warnings in the logs.
Still, IMO broken shortcuts should be deleted when the record is deleted as well (sounds easier than it probably is, I know). And maybe there is a way to identify and clean up broken shortcuts? Manually this could be done with SQL by deleting all records from sys_be_shortcuts with empty route/arguments fields.
I'm also not sure how this shortcut was created in the first place. This particular TYPO3 installation started with TYPO3 3.8 about 20 years ago, and the user was created in 2009...
Tested on TYPO3 11.5.38, but the code in ShortcutRepository.php looks similar in TYPO3 12.
Files
Updated by Garvin Hicking 4 months ago
- Status changed from New to Needs Feedback
Thanks for the report; this should be caught, I agree.
Do you by chance have SQL dumps for the used shortcuts for sage reproducability?
Updated by Florian Seirer 4 months ago
INSERT INTO sys_be_shortcuts (userid,route,arguments) VALUES (70,'record_edit','[]');
Replace 70 with the uid of one of your users and login with that user while the debug preset is active.
Updated by Florian Seirer 4 months ago
delete from sys_be_shortcuts where arguments='[]';
should probably fix it manually.
I don't know if newer TYPO3 installation could even create shortcuts like this. It might very well be a legacy bug.
Updated by Garvin Hicking 4 months ago
- Assignee set to Garvin Hicking
Thanks, will check out, also if its maybe part of a migration wizard that may not have gotten executed.
Updated by Gerrit Code Review 4 months ago
- Status changed from Needs Feedback to Under Review
Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/85548
Updated by Gerrit Code Review 4 months ago
Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/85548
Updated by Gerrit Code Review 4 months ago
Patch set 1 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/85463
Updated by Gerrit Code Review 4 months ago
Patch set 1 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/85464
Updated by Garvin Hicking 4 months ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 5444d2f00148447c932a3fa9166dd7653f796206.