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