Bug #85063

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

Added by Peter Kraume over 1 year ago. Updated 5 months ago.

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

100%

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_cfg Closed 2017-08-17
Related to TYPO3 Core - Bug #84139: l18n_cfg not respected in sysext/frontend/Classes/Page/PageRepository.php Closed 2018-03-05
Related to TYPO3 Core - Bug #75014: l18n_cfg not respected in fluid_styled_contents of type special menu Closed 2016-03-10
Related to TYPO3 Core - Bug #85149: \TYPO3\CMS\Frontend\Page\PageRepository::getPage needs to care about version overlay Closed 2018-06-04
Related to TYPO3 Core - Task #85339: Revert "Honor l18n_cfg in PageRepository" Closed 2018-06-22

Associated revisions

Revision 7e8a72cf (diff)
Added by Georg Ringer over 1 year ago

[BUGFIX] Honor l18n_cfg settings in PageRepository

If a page record is fetched from the database, the PageRepository needs
to care about the l18n_cfg setting for this page.

Resolves: #85063
Releases: master, 8.7
Change-Id: Ib0338a4725a3b569b91f27baa3a59cabee6fe2fb
Reviewed-on: https://review.typo3.org/57038
Reviewed-by: Anja Leichsenring <>
Tested-by: Anja Leichsenring <>
Tested-by: TYPO3com <>
Tested-by: Mona Muzaffar <>
Reviewed-by: Mona Muzaffar <>
Reviewed-by: Andreas Wolf <>
Tested-by: Andreas Wolf <>

Revision 416efd8d (diff)
Added by Nicole Cordes about 1 year ago

[BUGFIX] Do not link l18n_cfg restricted pages

Prevent linking a page that is either restricted for the default
language or where any fallback is forbidden.

Resolves: #85063
Releases: master, 8.7
Change-Id: I9dd1f7b5b357c60114f72898ddffa9ecf7305bf2
Reviewed-on: https://review.typo3.org/57276
Tested-by: TYPO3com <>
Reviewed-by: Mathias Brodala <>
Reviewed-by: Stefan Neufeind <>
Tested-by: Stefan Neufeind <>

Revision c2d1150c (diff)
Added by Nicole Cordes about 1 year ago

[BUGFIX] Do not link l18n_cfg restricted pages

Prevent linking a page that is either restricted for the default
language or where any fallback is forbidden.

Resolves: #85063
Releases: master, 8.7
Change-Id: I9dd1f7b5b357c60114f72898ddffa9ecf7305bf2
Reviewed-on: https://review.typo3.org/57345
Tested-by: TYPO3com <>
Reviewed-by: Peter Kraume <>
Tested-by: Peter Kraume <>
Reviewed-by: Stefan Neufeind <>
Tested-by: Stefan Neufeind <>

History

#1 Updated by Gerrit Code Review over 1 year 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 over 1 year 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 over 1 year ago

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

#4 Updated by Tymoteusz Motylewski over 1 year ago

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

#5 Updated by Tymoteusz Motylewski over 1 year ago

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

#6 Updated by Gerrit Code Review over 1 year 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 over 1 year 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 over 1 year 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 over 1 year 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 over 1 year 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 over 1 year 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 over 1 year ago

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

#13 Updated by Gerrit Code Review over 1 year 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 over 1 year 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 over 1 year 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 over 1 year ago

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

#17 Updated by Gerrit Code Review over 1 year 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 1 year ago

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

#19 Updated by Benni Mack about 1 year ago

  • Status changed from Under Review to Accepted

#20 Updated by Gerrit Code Review about 1 year 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 about 1 year ago

  • Status changed from Under Review to Resolved

#22 Updated by Benni Mack 12 months ago

  • Status changed from Resolved to Closed

#23 Updated by Lorenz Ulrich 5 months 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?

Also available in: Atom PDF