From 90b8572246cc22b42d126c079ae2618a3f63d8c2 Mon Sep 17 00:00:00 2001
From: Thomas Hohn <thomas@hohn.dk>
Date: Thu, 2 Feb 2023 08:44:38 +0100
Subject: [PATCH] [BUGFIX] Fix PHP 8 warning in ExtendedTemplateService

The method getTemplateQueryBuilder has a reference to
$GLOBALS['BE_USER']->workspace. This value should be
fetched via the WorkspaceAspect.

Resolves: #99795
Releases: 11.5
Change-Id: Ia5444b582da7436ab653923bbd8f91d87710a7b8
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/77670
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: core-ci <typo3@b13.com>
Tested-by: Benni Mack <benni@typo3.org>
---
 .../sysext/core/Classes/TypoScript/ExtendedTemplateService.php  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/typo3/sysext/core/Classes/TypoScript/ExtendedTemplateService.php b/typo3/sysext/core/Classes/TypoScript/ExtendedTemplateService.php
index 13fe34f00209..0ef210b9f1e8 100644
--- a/typo3/sysext/core/Classes/TypoScript/ExtendedTemplateService.php
+++ b/typo3/sysext/core/Classes/TypoScript/ExtendedTemplateService.php
@@ -706,7 +706,7 @@ class ExtendedTemplateService extends TemplateService
         $queryBuilder->getRestrictions()
             ->removeAll()
             ->add(GeneralUtility::makeInstance(DeletedRestriction::class))
-            ->add(GeneralUtility::makeInstance(WorkspaceRestriction::class, $GLOBALS['BE_USER']->workspace));
+            ->add(GeneralUtility::makeInstance(WorkspaceRestriction::class, $this->context->getAspect('workspace')->get('id')));
 
         $queryBuilder->select('*')
             ->from('sys_template')
-- 
GitLab