Project

General

Profile

Actions

Bug #104496

closed

PHP warnings with broken backend shortcuts

Added by Florian Seirer 3 months ago. Updated 12 days ago.

Status:
Closed
Priority:
Should have
Category:
Backend User Interface
Target version:
-
Start date:
2024-07-29
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
11
PHP Version:
8.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

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

clipboard-202407291350-jmi9u.png (9.83 KB) clipboard-202407291350-jmi9u.png Florian Seirer, 2024-07-29 11:50
Actions #1

Updated by Garvin Hicking 3 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?

Actions #2

Updated by Florian Seirer 3 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.

Actions #3

Updated by Florian Seirer 3 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.

Actions #4

Updated by Garvin Hicking 3 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.

Actions #5

Updated by Gerrit Code Review 3 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

Actions #6

Updated by Gerrit Code Review 3 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

Actions #7

Updated by Gerrit Code Review 3 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

Actions #8

Updated by Gerrit Code Review 3 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

Actions #9

Updated by Garvin Hicking 3 months ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #10

Updated by Benni Mack 12 days ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF