Commit e131831e authored by Oliver Bartsch's avatar Oliver Bartsch
Browse files

[BUGFIX] Handle disabled default language in PageContentErrorHandler

The SiteInterface provides the "getDefaultLanguage()"
method, which will always return the first configured
language - usually L=0. However, this language might
be disabled, which means, it should not be visible
in frontend context.

The PageContentErrorHandler therefore now tries
to fetch the first enabled language, in case the
requested language id does not exist in the current
site and the sites' default language is disabled.

Resolves: #99530
Releases: main, 11.5
Change-Id: Ib02cbd8f01a4fc1a69be46ad2015e8863553fae0

Tested-by: Oliver Bartsch's avatarOliver Bartsch <>
Reviewed-by: Benni Mack's avatarBenni Mack <>
Tested-by: Stefan Bürk's avatarStefan Bürk <>
Tested-by: core-ci's avatarcore-ci <>
Tested-by: Anja Leichsenring's avatarAnja Leichsenring <>
Reviewed-by: Stefan Bürk's avatarStefan Bürk <>
Reviewed-by: Anja Leichsenring's avatarAnja Leichsenring <>
Reviewed-by: Oliver Bartsch's avatarOliver Bartsch <>
parent 36177e36
......@@ -157,6 +157,18 @@ class PageContentErrorHandler implements PageErrorHandlerInterface
$language = $site->getDefaultLanguage();
// Requested language or default language is disabled in current site => Fetch first "enabled" language
if (!$language->isEnabled()) {
$enabledLanguages = $site->getLanguages();
if ($enabledLanguages === []) {
throw new \RuntimeException(
'Site ' . $site->getIdentifier() . ' does not define any enabled language.',
$language = reset($enabledLanguages);
// Build Url
$uri = $site->getRouter()->generateUri(
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment