From f02411d42528e6915bf40c6a6e58478a305a9216 Mon Sep 17 00:00:00 2001
From: Susanne Moog <susanne.moog@typo3.org>
Date: Mon, 9 Apr 2018 20:47:02 +0200
Subject: [PATCH] [BUGFIX] Do not call deprecated feedit initialize method

Resolves: #84677
Releases: master
Change-Id: I2d1887dd982e95e633755eed75f3bb0cdfe4d4ec
Reviewed-on: https://review.typo3.org/56618
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: TYPO3com <no-reply@typo3.com>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Oliver Hader <oliver.hader@typo3.org>
Tested-by: Oliver Hader <oliver.hader@typo3.org>
---
 .../FrontendEditing/FrontendEditingController.php        | 9 +++++----
 .../feedit/Classes/Middleware/FrontendEditInitiator.php  | 6 +++++-
 typo3/sysext/frontend/Classes/Http/RequestHandler.php    | 9 ---------
 3 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/typo3/sysext/core/Classes/FrontendEditing/FrontendEditingController.php b/typo3/sysext/core/Classes/FrontendEditing/FrontendEditingController.php
index c3b3a9abe205..eae8d2bac5b2 100644
--- a/typo3/sysext/core/Classes/FrontendEditing/FrontendEditingController.php
+++ b/typo3/sysext/core/Classes/FrontendEditing/FrontendEditingController.php
@@ -48,10 +48,11 @@ class FrontendEditingController
     {
         $this->TSFE_EDIT = GeneralUtility::_GP('TSFE_EDIT');
         // Include classes for editing IF editing module in Admin Panel is open
-        if ($GLOBALS['BE_USER']->isFrontendEditingActive()) {
-            if ($this->isEditAction()) {
-                $this->editAction();
-            }
+        if (((int)$GLOBALS['TSFE']->displayEditIcons === 1
+            || (int)$GLOBALS['TSFE']->displayFieldEditIcons === 1)
+            && $this->isEditAction()
+        ) {
+            $this->editAction();
         }
     }
 
diff --git a/typo3/sysext/feedit/Classes/Middleware/FrontendEditInitiator.php b/typo3/sysext/feedit/Classes/Middleware/FrontendEditInitiator.php
index 96c7ede4ec2d..29b8ade5d3de 100644
--- a/typo3/sysext/feedit/Classes/Middleware/FrontendEditInitiator.php
+++ b/typo3/sysext/feedit/Classes/Middleware/FrontendEditInitiator.php
@@ -21,6 +21,7 @@ use Psr\Http\Message\ServerRequestInterface;
 use Psr\Http\Server\MiddlewareInterface;
 use Psr\Http\Server\RequestHandlerInterface;
 use TYPO3\CMS\Backend\FrontendBackendUserAuthentication;
+use TYPO3\CMS\Core\FrontendEditing\FrontendEditingController;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
 
@@ -40,7 +41,7 @@ class FrontendEditInitiator implements MiddlewareInterface
      */
     public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
     {
-        if ($GLOBALS['BE_USER'] instanceof FrontendBackendUserAuthentication) {
+        if (isset($GLOBALS['BE_USER']) && $GLOBALS['BE_USER'] instanceof FrontendBackendUserAuthentication) {
             $config = $GLOBALS['BE_USER']->getTSConfigProp('admPanel');
             $active = (int)$GLOBALS['TSFE']->displayEditIcons === 1 || (int)$GLOBALS['TSFE']->displayFieldEditIcons === 1;
             if ($active && isset($config['enable.'])) {
@@ -56,6 +57,9 @@ class FrontendEditInitiator implements MiddlewareInterface
                         $controllerClass = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController'][$controllerKey];
                         if ($controllerClass) {
                             $GLOBALS['BE_USER']->frontendEdit = GeneralUtility::makeInstance($controllerClass);
+                            if ($controllerClass instanceof FrontendEditingController) {
+                                $GLOBALS['BE_USER']->frontendEdit->initConfigOptions();
+                            }
                         }
                         break;
                     }
diff --git a/typo3/sysext/frontend/Classes/Http/RequestHandler.php b/typo3/sysext/frontend/Classes/Http/RequestHandler.php
index e00620edc6d7..bff3d7c30c39 100644
--- a/typo3/sysext/frontend/Classes/Http/RequestHandler.php
+++ b/typo3/sysext/frontend/Classes/Http/RequestHandler.php
@@ -19,7 +19,6 @@ namespace TYPO3\CMS\Frontend\Http;
 use Psr\Http\Message\ResponseInterface;
 use Psr\Http\Message\ServerRequestInterface;
 use Psr\Http\Server\RequestHandlerInterface as PsrRequestHandlerInterface;
-use TYPO3\CMS\Core\FrontendEditing\FrontendEditingController;
 use TYPO3\CMS\Core\Http\NullResponse;
 use TYPO3\CMS\Core\Http\RequestHandlerInterface;
 use TYPO3\CMS\Core\Http\Response;
@@ -69,14 +68,6 @@ class RequestHandler implements RequestHandlerInterface, PsrRequestHandlerInterf
         /** @var TypoScriptFrontendController $controller */
         $controller = $GLOBALS['TSFE'];
 
-        // Admin Panel & Frontend editing
-        if ($controller->isBackendUserLoggedIn()) {
-            $GLOBALS['BE_USER']->initializeFrontendEdit();
-            if ($GLOBALS['BE_USER']->frontendEdit instanceof FrontendEditingController) {
-                $GLOBALS['BE_USER']->frontendEdit->initConfigOptions();
-            }
-        }
-
         // Starts the template
         $this->timeTracker->push('Start Template', '');
         $controller->initTemplate();
-- 
GitLab