Issue Bug Closed

#99444Core: Exception handler (WEB: FE): Error, code #0, file TypoScriptFrontendController.php, line 2099: Attempt to assign property "rootLine" on null

Christian Toffolo 01/02/23, 09:44 updated 10/24/26, 07:03

Description

Generated by Googlebot visiting a translated page that is a shortcut to another page like:
http://domain.ext/es/soporte/
that is a shortcut to page with uid=3

PHP error log:
Mon, 02 Jan 2023 08:38:14 +0100 [WARNING] request=“31bc2c162961e” component=“TYPO3.CMS.Core.Error.ErrorHandler”: Core: Error handler (FE): PHP Warning: Undefined array key “uid” in typo3/sysext/core/Classes/Domain/Repository/PageRepository.php line 1101
Mon, 02 Jan 2023 08:38:14 +0100 [WARNING] request=“31bc2c162961e” component=“TYPO3.CMS.Core.Error.ErrorHandler”: Core: Error handler (FE): PHP Warning: Undefined array key “uid” in typo3/sysext/core/Classes/Domain/Repository/PageRepository.php line 1112
Mon, 02 Jan 2023 08:38:14 +0100 [CRITICAL] request=“31bc2c162961e” component=“TYPO3.CMS.Core.Error.ProductionExceptionHandler”: Core: Exception handler (WEB: FE): Error, code #0, file typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php, line 2099: Attempt to assign property “rootLine” on null – {mode“WEB”,application_mode“FE”,exception_class“Error”,“exception_code”:0,“file”:“typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php”,“line”:2099,“message”:“Attempt to assign property \“rootLine\” on null”,request_url“https://domain.ext/es/soporte/”,exception

Reviews 0

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

History 5

  1. Gerhard Pazout commented 02/06/23, 11:08

    I have the same error!

    Steps to reproduce:
    1. Translate a page thats a shortcut (doktype = shortcut)
    2. For “Shortcut Mode” set “Translation behaviour” to “Custom value”.
    3. For “Shortcut Target” set “Translation behaviour” to “Custom value”.
    4. For the translated page the “Shortcut Target” has to be different than in the original page (important)

    *Expected result:*
    Exception in Frontend that says:

    Attempt to assign property "rootLine" on null

    The error occurs because in \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController $this->tmpl is not set before the function checkTranslatedShortcut gets called!

    *How I fixed it:*
    In the class \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController inside the function checkTranslatedShortcut add the following line so that $this->tmpl is not null anymore:

    if (!$this->tmpl instanceof TemplateService) {
       $this->tmpl = GeneralUtility::makeInstance(TemplateService::class, $this->context, null, $this);
    }

    So the function checkTranslatedShortcut looks like this:

        /**
         * Checks whether a translated shortcut page has a different shortcut
         * target than the original language page.
         * If that is the case, things get corrected to follow that alternative
         * shortcut
         * @param int $languageId
         * @param ServerRequestInterface $request
         */
        protected function checkTranslatedShortcut(int $languageId, ServerRequestInterface $request)
        {
            if (!$this->tmpl instanceof TemplateService) {
                $this->tmpl = GeneralUtility::makeInstance(TemplateService::class, $this->context, null, $this);
            }
    
            if (!is_null($this->originalShortcutPage)) {
                $originalShortcutPageOverlay = $this->sys_page->getPageOverlay($this->originalShortcutPage['uid'], $languageId);
                if (!empty($originalShortcutPageOverlay['shortcut']) && $originalShortcutPageOverlay['shortcut'] != $this->id) {
                    // the translation of the original shortcut page has a different shortcut target!
                    // set the correct page and id
                    $shortcut = $this->sys_page->resolveShortcutPage($originalShortcutPageOverlay, true);
                    $this->id = ($this->contentPid = $shortcut['uid']);
                    $this->page = $this->sys_page->getPage($this->id);
                    // Fix various effects on things like menus f.e.
                    $this->fetch_the_id($request);
                    $this->tmpl->rootLine = array_reverse($this->rootLine);
                }
            }
        }
  2. Bernhard Eckl commented 08/14/23, 11:16

    Same here. Your fix works also for me. Thank you!

    TYPO3 11.5.30
    PHP 8.2

  3. Garvin Hicking changed category 08/08/24, 09:42

  4. Benni Mack commented and changed status New Needs Feedback 03/25/25, 13:43

    Hey,

    does this problem still happen on v13?

  5. Benni Mack commented and changed status Needs Feedback Closed 10/24/26, 07:03

    The code path that caused this (TypoScriptFrontendController::checkTranslatedShortcut()) was removed in TYPO3 v12.0 with #96540. Since then, the page translation is applied before the shortcut target is resolved, so a translated shortcut with a custom target
    is followed directly. This exact case is covered by SlugSiteRequestTest::crossSiteShortcutsAreRedirected (“shortcut of translated page is
    redirected to a different page than the original page”), which passes on main.

    v11.5 is out of community support, so I’m closing this issue. Feel free to reopen if you can reproduce it on v13.4 or v14.