From 06f1f367c4c10f6dc562c82b4a08e5485d0b5491 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christian=20E=C3=9Fl?= <indy.essl@gmail.com>
Date: Tue, 7 Mar 2023 14:37:55 +0100
Subject: [PATCH] [BUGFIX] ext:seo widget: Ensure language exists in site

Ensure the language of the checked record actually exists in
the site, in case orphan records of other languages are
present.

Resolves: #100111
Releases: main
Change-Id: I5cb3d2e09cfc86b5d43eba9e16b3833afe18e6b8
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/78046
Tested-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Kevin Appelt <kevin.appelt@icloud.com>
Tested-by: core-ci <typo3@b13.com>
Reviewed-by: Kevin Appelt <kevin.appelt@icloud.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
---
 .../Widgets/Provider/PagesWithoutDescriptionDataProvider.php  | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/typo3/sysext/seo/Classes/Widgets/Provider/PagesWithoutDescriptionDataProvider.php b/typo3/sysext/seo/Classes/Widgets/Provider/PagesWithoutDescriptionDataProvider.php
index 6830bba9ef32..a91a6e2bd814 100644
--- a/typo3/sysext/seo/Classes/Widgets/Provider/PagesWithoutDescriptionDataProvider.php
+++ b/typo3/sysext/seo/Classes/Widgets/Provider/PagesWithoutDescriptionDataProvider.php
@@ -53,7 +53,9 @@ final class PagesWithoutDescriptionDataProvider
             $pageId = $row['l10n_parent'] ?: $row['uid'];
             try {
                 $site = $this->siteFinder->getSiteByPageId($pageId);
-            } catch (SiteNotFoundException) {
+                // make sure the language of the row actually exists in the site
+                $site->getLanguageById($row['sys_language_uid']);
+            } catch (SiteNotFoundException | \InvalidArgumentException) {
                 continue;
             }
             $router = $site->getRouter();
-- 
GitLab