Bug #85063

\TYPO3\CMS\Frontend\Typolink\PageLinkBuilder::build doesn't honor l18n_cfg settings

Added by Peter Kraume about 3 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Frontend
Target version:
-
Start date:
2018-05-22
Due date:
% Done:

100%

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

Description

Links to a page within TYPO3, that has the l18n_cfg flag set for "Hide default translation of page", result in TYPO3 creating broken links which leads to a 404 error.

How to reproduce:
  1. create a page and enable "Hide default translation of page" in page settings
  2. go somewhere else and create a link to that page e.g. in the RTE

Current behavior:
TYPO3 creates a link to the page but the link broken (404)

Expected behavior:
TYPO3 should not create the link

Scope of the problem:
This bug effects all places where, e.g. $this->cObj->typoLink_URL() is used.
- TypoScript and typolink usage
- any record that has a link field (tt_content, tx_news, etc.)

I haven't checked it yet, but I assume that TYPO3 7.6 is affected as well.


Related issues

Related to TYPO3 Core - Bug #82122: Typo3DbBackend::doLanguageAndWorkspaceOverlay ignores pages l18n_cfgClosed2017-08-17

Actions
Related to TYPO3 Core - Bug #84139: l18n_cfg not respected in sysext/frontend/Classes/Page/PageRepository.phpClosed2018-03-05

Actions
Related to TYPO3 Core - Bug #75014: l18n_cfg not respected in fluid_styled_contents of type special menuClosed2016-03-10

Actions
Related to TYPO3 Core - Bug #85149: \TYPO3\CMS\Frontend\Page\PageRepository::getPage needs to care about version overlayClosed2018-06-04

Actions
Related to TYPO3 Core - Task #85339: Revert "Honor l18n_cfg in PageRepository"ClosedBenni Mack2018-06-22

Actions
Related to TYPO3 Core - Bug #90850: typolink generates links for non-reachable pagesClosed2020-03-27

Actions
#1

Updated by Gerrit Code Review about 3 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57038

#2

Updated by Gerrit Code Review about 3 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57038

#3

Updated by Tymoteusz Motylewski about 3 years ago

  • Related to Bug #82122: Typo3DbBackend::doLanguageAndWorkspaceOverlay ignores pages l18n_cfg added
#4

Updated by Tymoteusz Motylewski about 3 years ago

  • Related to Bug #84139: l18n_cfg not respected in sysext/frontend/Classes/Page/PageRepository.php added
#5

Updated by Tymoteusz Motylewski about 3 years ago

  • Related to Bug #75014: l18n_cfg not respected in fluid_styled_contents of type special menu added
#6

Updated by Gerrit Code Review about 3 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57038

#7

Updated by Gerrit Code Review about 3 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57038

#8

Updated by Gerrit Code Review about 3 years ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57038

#9

Updated by Gerrit Code Review about 3 years ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57038

#10

Updated by Gerrit Code Review about 3 years ago

Patch set 7 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57038

#11

Updated by Gerrit Code Review about 3 years ago

Patch set 1 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57116

#12

Updated by Georg Ringer about 3 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
#13

Updated by Gerrit Code Review about 3 years ago

  • Status changed from Resolved to Under Review

Patch set 2 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57116

#14

Updated by Gerrit Code Review about 3 years ago

Patch set 3 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57116

#15

Updated by Gerrit Code Review about 3 years ago

Patch set 4 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57116

#16

Updated by Anja Leichsenring about 3 years ago

  • Related to Bug #85149: \TYPO3\CMS\Frontend\Page\PageRepository::getPage needs to care about version overlay added
#17

Updated by Gerrit Code Review about 3 years ago

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57276

#18

Updated by Benni Mack about 3 years ago

  • Related to Task #85339: Revert "Honor l18n_cfg in PageRepository" added
#19

Updated by Benni Mack about 3 years ago

  • Status changed from Under Review to Accepted
#20

Updated by Gerrit Code Review about 3 years ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/57345

#21

Updated by Nicole Cordes almost 3 years ago

  • Status changed from Under Review to Resolved
#22

Updated by Benni Mack over 2 years ago

  • Status changed from Resolved to Closed
#23

Updated by Lorenz Ulrich about 2 years ago

The code introduced to TYPO3 8.7 breaks a use-case of mine. I'm not sure if it is valid, so I hope someone can help me validate:

(Simplified) situation: TYPO3 8.7 site with two languages German (default, 0) and English (1).

I want to create a link to a site that is configured to be hidden in the Default language (l18n_cfg = 1). Obviously, I want to create a link to the English version of this page.

This is my code:

$targetUri = $GLOBALS['TSFE']->cObj->typoLink_URL(
    [
        'parameter' => 777,
        'additionalParams' => '&L=1',
        'forceAbsoluteUrl' => true,
    ]
);

Now, PageLinkBuilder->build fetches the page with ID 777. At this point, it does not do a language overlay because the link is generated on a German page.

Therefore, the code introduced sets $language = 0; because there is no _PAGES_OVERLAY field in the record. So this leads the exception introduced with this change:

$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);
}

So it seems I cannot build an URL from the default language to a site that only exists in a non-default language.

Georg or Nicole, can you confirm this? Should this be possible or not?

#24

Updated by Markus Klein about 1 year ago

  • Related to Bug #90850: typolink generates links for non-reachable pages added

Also available in: Atom PDF