From 61d4c55757f1c8e358fecbc33d63dd46e77e5325 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20B=C3=BCrk?= <stefan@buerk.tech>
Date: Tue, 5 Sep 2023 15:44:18 +0200
Subject: [PATCH] [BUGFIX] Avoid native PHP warnings in
 FrontendBackendUserAuthentication
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Avoid native PHP warnings in FrontendBackendUserAuthentication
because of invalid array key access. The places are now guarded
using null coalescing operator with a suitable fallback value.

Resolves: #101848
Resolves: #101847
Releases: main, 12.4, 11.5
Change-Id: Iaf747172b6ac04b9d2bdbf60519346ef7e3b3f2f
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/80845
Tested-by: core-ci <typo3@b13.com>
Tested-by: Stefan Bürk <stefan@buerk.tech>
Reviewed-by: Stefan Bürk <stefan@buerk.tech>
---
 .../backend/Classes/FrontendBackendUserAuthentication.php     | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/typo3/sysext/backend/Classes/FrontendBackendUserAuthentication.php b/typo3/sysext/backend/Classes/FrontendBackendUserAuthentication.php
index bf3242934072..c5613a1e3200 100644
--- a/typo3/sysext/backend/Classes/FrontendBackendUserAuthentication.php
+++ b/typo3/sysext/backend/Classes/FrontendBackendUserAuthentication.php
@@ -104,7 +104,7 @@ class FrontendBackendUserAuthentication extends BackendUserAuthentication
             $languageId = $languageAspect->getId();
         } elseif ($table === 'tt_content') {
             $languageId = $languageAspect->getContentId();
-        } elseif ($GLOBALS['TCA'][$table]['ctrl']['languageField']) {
+        } elseif ($GLOBALS['TCA'][$table]['ctrl']['languageField'] ?? false) {
             $languageId = $currentRecord[$GLOBALS['TCA'][$table]['ctrl']['languageField']];
         } else {
             $languageId = -1;
@@ -176,7 +176,7 @@ class FrontendBackendUserAuthentication extends BackendUserAuthentication
     {
         $types = GeneralUtility::trimExplode(',', strtolower($conf['allow']), true);
         $allow = array_flip($types);
-        if (!$conf['onlyCurrentPid'] || $pid == $GLOBALS['TSFE']->id) {
+        if (!($conf['onlyCurrentPid'] ?? false) || $pid == $GLOBALS['TSFE']->id) {
             // Permissions
             $types = GeneralUtility::trimExplode(',', strtolower($conf['allow']), true);
             $allow = array_flip($types);
-- 
GitLab