Project

General

Profile

Actions

Bug #45289

closed

Usage of id=pageAlias is broken while logged in in BE

Added by Christian Herberger almost 12 years ago. Updated about 10 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Frontend
Target version:
-
Start date:
2013-02-08
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
6.0
PHP Version:
5.3
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

We often use pagealiases to identify pages with specific functions. When we upgraded a site from 4.5.x to 6.0.x, these pages stopped working when we were in the BE at the same time.
The Exception is #1343589451: Could not fetch page data for uid 0

This problem comes from \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->determineId(), line 1172. This line is called if you are logged in in the BE and gets the rootline for a page. Now here's the catch - while calling the $temp_sys_page->getRootLine(), $this->id is still the alias. In getRootLine, one of the first things happening is that the intval() of $this->id is determined. This number has nothing to do with the alias (if there is a number at all) - so the rootline generation is wrong at best and fails most of the time because it tries to build the rootline for page 0 (but only if we are not in a workspace at the same time)

A quick fix is to imitate the method \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->checkAndSetAlias() and tranlate the alias to an ID, then call the getRootline-stuff. To achieve this, we added following lines in the TypoScriptFrontendController, starting at line 1171 (after $temp_sys_page->init($this->showHiddenPage);)

if ($this->id && !\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->id)) {
    $aid = $temp_sys_page->getPageIdFromAlias($this->id);
    if ($aid) {
        $this->id = $aid;
    } else {
        $this->pageNotFound = 4;
    }
}

This is a quite ugly workaround because it can be that $this->pageNotFound is set and then isn't respected afterwards, so the same exception would be thrown. But at the moment, this is the best we can do to help ourselves. If someone could provide a better fix or help in building one, it would be appreciated.

Actions

Also available in: Atom PDF