Issue Bug Closed

#104496PHP warnings with broken backend shortcuts

Florian Seirer 07/29/24, 12:01 updated 10/15/24, 09:08

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.
clipboard-202407291350-jmi9u.png

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.

Reviews 3

Files 1

History 610

  1. Garvin Hicking commented and changed status New Needs Feedback 07/29/24, 19:10

    Thanks for the report; this should be caught, I agree.

    Do you by chance have SQL dumps for the used shortcuts for sage reproducability?

  2. Florian Seirer commented 07/31/24, 10:29

    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.

  3. Florian Seirer commented 07/31/24, 10:51

    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.

  4. Garvin Hicking commented and changed assigned to Garvin Hicking 08/01/24, 14:24

    Thanks, will check out, also if its maybe part of a migration wizard that may not have gotten executed.

  5. Gerrit Code Review pushed patch set 1 for main to change 85548 status Needs Feedback Under Review 08/06/24, 22:14

  6. Gerrit Code Review pushed patch set 2 for main to change 85548 08/07/24, 08:11

  7. Gerrit Code Review pushed patch set 1 for 12.4 to change 85463 08/07/24, 16:48

  8. Gerrit Code Review pushed patch set 1 for 11.5 to change 85464 08/07/24, 16:49

  9. Garvin Hicking commented and changed status Under Review Resolved done 0 % 100 % 08/07/24, 17:25

    Applied in changeset commit:5444d2f00148447c932a3fa9166dd7653f796206.

  10. Benni Mack changed status Resolved Closed 10/15/24, 09:08