Actions
Bug #99518
closedCustom page shortcut target for translated page causes errors
Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Site Handling, Site Sets & Routing
Target version:
-
Start date:
2023-01-11
Due date:
% Done:
0%
Estimated time:
TYPO3 Version:
11
PHP Version:
8.0
Tags:
Complexity:
Is Regression:
Sprint Focus:
Description
If you want to set a custom shortcut target for a translated page, TYPO3 does not resolve the shortcut correctly but runs into an error. I am aware of the already reported bugs relating the shortcuts, but this specific issue seems to be new / undocumented.
Setup:- TYPO3 version 11.5.22
- Simple multilanguage setup
- Shortcut target for default language is Page A
- Shortcut target for second language is Page B with translation behavior "Custom value")
- Shortcut page and shortcut targets are all visible and translated
If you call the translated shortcut page you get an error response depending on the current mode:
In DEBUG mode:
PHP Warning: Undefined array key "uid" in /shared/httpd/vonardenne/files/typo3/public/typo3/sysext/core/Classes/Domain/Repository/PageRepository.php line 1101
The transferred page array does not contain uid / pid as it is an overlay record. Source of this call is the function "checkTranslatedShortcut" in "TyposcriptFrontendController.php".
$originalShortcutPageOverlay = $this->sys_page->getPageOverlay($this->originalShortcutPage['uid'], $languageId);
...
$shortcut = $this->sys_page->resolveShortcutPage($originalShortcutPageOverlay, true);
The call of "resolveShortcutPage" causes the problem. As far as i understand it is correct that "$originalShortcutPageOverlay" does not have uid / pid. Thereby this should not be used as direct argument for "resolveShortcutPage()".
If you call resolveShortcutPage with a merged array of original and overlay record, the warning disappears and we get a valid response from this function. However the shortcut still won't work because there is a followup error, which is the same as in production mode.
In PRODUCTION mode:
Error: Attempt to assign property "rootLine" on null in /shared/httpd/vonardenne/files/typo3/public/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php line 2101
The responsible code (also from function "checkTranslatedShortcut") is:
$this->tmpl->rootLine = array_reverse($this->rootLine);
It looks like the template service is not initilized yet. I am bowing out at this point as i don't know where to fix this.
Actions