Project

General

Profile

Actions

Bug #99530

closed

Function getDefaultLanguage returns disabled language

Added by Sven Burkert over 1 year ago. Updated about 1 year ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Link Handling, Site Handling & Routing
Target version:
-
Start date:
2023-01-13
Due date:
% Done:

100%

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

Description

Function TYPO3\CMS\Core\Site\Entity\Site->getDefaultLanguage() (https://github.com/TYPO3/typo3/blob/10.4/typo3/sysext/core/Classes/Site/Entity/Site.php#L255) returns disabled languages. This comes into case when requesting a not existing page, e.g. www.mysite.tld/de_INT/not-existing/. Error handling now tries to resolve requested language (here: https://github.com/TYPO3/typo3/blob/10.4/typo3/sysext/core/Classes/Error/PageErrorHandler/PageContentErrorHandler.php#L210) and this is the disabled language "de_INT".

My site config is:

languages:
  -
    title: de_INT
    enabled: false
    languageId: '0'
    ...
  -
    title: en_INT
    enabled: true
    languageId: '1'
    ...

Function getDefaultLanguage() doesn't respect not enabled languages, so it returns de_INT, but should return en_INT.
This should fix it:

public function getDefaultLanguage(): SiteLanguage {
  $siteLanguages = $this->getLanguages();
  return = array_values($siteLanguages)[0];
}

Actions #1

Updated by Gerrit Code Review over 1 year ago

  • Status changed from New to Under Review

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

Actions #2

Updated by Gerrit Code Review over 1 year ago

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

Actions #3

Updated by Gerrit Code Review over 1 year ago

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

Actions #4

Updated by Gerrit Code Review over 1 year ago

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

Actions #5

Updated by Oliver Bartsch over 1 year ago

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

Updated by Benni Mack about 1 year ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF