Issue Bug Closed

#99518Custom page shortcut target for translated page causes errors

Ina Beckmann 01/11/23, 11:47 updated 08/19/24, 14:54

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.

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.