Bug #88563
closedLink generation should not be created when the target pid pages_language_overlay is disabled.
0%
Description
Scenario:
- Create two pages with pages_language_overlay.
- Disable one pages_language_overlay (e.g. pid 12)
- Create an link at the enabled pages_language_overlay, (for example use headerlink) to the pid (12) with the disabled pages_language_overlay.
- Go to the translated page with uri.
Result: the link created on the translated page goes to /index.php?id=12&L=1 is created. The uri results in 404 (the translated page is disabled so the 404 is correct).
Expected result: The created link should not be created at the first place
Cause of the issue:
In the PageLinkBuilder the page is retrieved by TSFE. In here the overlay is additionally added as a parameter "_PAGES_OVERLAY:.
Due that this translated page is disabled, no overlay is used -> "_PAGES_OVERLAY" is empty -> $language becomes 0;
There fore the check `$language > 0 && !isset($page['_PAGES_OVERLAY']) && GeneralUtility::hideIfNotTranslated($page['l18n_cfg'])` won't be invoked and the link creation continues.
// Looking up the page record to verify its existence:
$page = $tsfe->sys_page->getPage($linkDetails['pageuid'], $disableGroupAccessCheck);
if (empty($page)) {
throw new UnableToLinkException('Page id "' . $linkDetails['typoLinkParameter'] . '" was not found, so "' . $linkText . '" was not linked.', 1490987336, null, $linkText);
}
$language = empty($page['_PAGES_OVERLAY']) ? 0 : $page['_PAGES_OVERLAY_LANGUAGE'];
if ($language === 0 && GeneralUtility::hideIfDefaultLanguage($page['l18n_cfg'])) {
throw new UnableToLinkException('Default language of page "' . $linkDetails['typoLinkParameter'] . '" is hidden, so "' . $linkText . '" was not linked.', 1529527301, null, $linkText);
}
if ($language > 0 && !isset($page['_PAGES_OVERLAY']) && GeneralUtility::hideIfNotTranslated($page['l18n_cfg'])) {
throw new UnableToLinkException('Fallback to default language of page "' . $linkDetails['typoLinkParameter'] . '" is disabled, so "' . $linkText . '" was not linked.', 1529527488, null, $linkText);
}
Suggestion for the fix is to set the language to the sys_language when no `_PAGES_OVERLAY" is set.