#88563Link generation should not be created when the target pid pages_language_overlay is disabled.
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.
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.
History 6
-
Ruud Silvrants commented 06/14/19, 11:09
-
Susanne Moog changed Tags CodingNight 08/02/19, 19:36
-
Benni Mack commented and changed status
NewNeeds Feedback 12/23/19, 22:06Hi Ruud,
I think we fixed this with Site Handling and TYPO3 v9. Can you verify and recheck?
-
Riccardo De Contardi commented 03/15/20, 16:42
I performed the following test with the latest 10.4.0-dev version:
Prerequisites
1) TYPO3 10.4.0-dev with two languages configured (ITA, ENG)
2) TS Setup:page = PAGE page.5 = TEXT page.5 { data = page:title wrap = <h1>|</h1> } page.100 =< styles.content.get styles.content.get.select.includeRecordsWithoutDefaultTranslation = 1test
1) Create page test88563a – URL: https://typo3.test.it/test88563a
2) Translate it in english (test88563a-eng) – URL: https://typo3.test.it/en/test88563a-eng3) Create page test88563b – URL: https://typo3.test.it/test88563b
4) Translate it in english (test88563b-eng)
5) Disable test88563b-eng (Tab access > Hidden=1) – URL: https://typo3.test.it/en/test88563b-eng6) test88563a-eng > create a new content element, type: header only
6.1) edit it: [header]: test eng; [header_link]: link to page test88563b-eng
7) visit the URL https://typo3.test.it/en/test88563a-engResults
1) The content element with the link is visible, and the link is https://typo3.test.it/en/test88563b (so the italian pagename, just with the /en/ prefix)
2) Clicking on it you go to the italian version of the page; the same if you try to access directly https://typo3.test.it/en/test88563b-eng – you see the italian version of the page
3) If you use the setting[FE][hidePagesIfNotTranslatedByDefault] = truethen the link is still active, but acts as a 404 -
Benni Mack commented 01/17/23, 19:59
Hi,
I’d say this is correct behaviour?
-
Benni Mack commented and changed status
Needs FeedbackClosed 12/04/23, 23:20Closing this issue due to lack of feedback. If you feel this is the wrong behaviour, let me know so I can re-open this issue.
`$language = empty($page[‘_PAGES_OVERLAY’]) ? 0 : $page[‘_PAGES_OVERLAY_LANGUAGE’];`
Should be changed to ` $language = empty($page[‘_PAGES_OVERLAY’]) ? $tsfe->sys_language_uid : $page[‘_PAGES_OVERLAY_LANGUAGE’];`