Bug #88563

Link generation should not be created when the target pid pages_language_overlay is disabled.

Added by Ruud Silvrants over 1 year ago. Updated 11 months ago.

Status:
Needs Feedback
Priority:
Should have
Assignee:
-
Category:
Frontend
Target version:
-
Start date:
2019-06-14
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
8
PHP Version:
7.2
Tags:
CodingNight
Complexity:
Is Regression:
Sprint Focus:

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.

#1

Updated by Ruud Silvrants over 1 year ago

`$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'];`

#2

Updated by Susanne Moog over 1 year ago

  • Tags set to CodingNight
#3

Updated by Benni Mack about 1 year ago

  • Status changed from New to Needs Feedback

Hi Ruud,

I think we fixed this with Site Handling and TYPO3 v9. Can you verify and recheck?

#4

Updated by Riccardo De Contardi 11 months ago

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 = 1

test

1) Create page test88563a - URL: https://typo3.test.it/test88563a
2) Translate it in english (test88563a-eng) - URL: https://typo3.test.it/en/test88563a-eng

3) 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-eng

6) 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-eng

Results

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] = true then the link is still active, but acts as a 404

Also available in: Atom PDF