[BUGFIX] Fix backend user check in ProductionExceptionHandler 88/55688/5
authorBenjamin Franzke <bfr@qbus.de>
Mon, 12 Feb 2018 20:49:40 +0000 (21:49 +0100)
committerSusanne Moog <susanne.moog@typo3.org>
Mon, 12 Feb 2018 21:51:13 +0000 (22:51 +0100)
Uncaught Error: Call to a member function isBackendUserLoggedIn() on null
in […]/typo3/sysext/core/Classes/Error/ProductionExceptionHandler.php:103

Change-Id: I0052c2c1cd617282dbc65320933f8577038ab41c
Releases: master, 8.7
Resolves: #83867
Reviewed-on: https://review.typo3.org/55688
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
typo3/sysext/core/Classes/Error/ProductionExceptionHandler.php

index 61a3b72..fb9e6e0 100644 (file)
@@ -13,14 +13,15 @@ namespace TYPO3\CMS\Core\Error;
  *
  * The TYPO3 project - inspiring people to share!
  */
+use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
 use TYPO3\CMS\Core\Controller\ErrorPageController;
 use TYPO3\CMS\Core\Messaging\AbstractMessage;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /**
- * A quite exception handler which catches but ignores any exception.
- *
- * This file is a backport from FLOW3
+ * An exception handler which catches any exception and
+ * renders an error page without backtrace (Web) or a slim
+ * message on CLI.
  */
 class ProductionExceptionHandler extends AbstractExceptionHandler
 {
@@ -98,11 +99,11 @@ class ProductionExceptionHandler extends AbstractExceptionHandler
         if ($exception instanceof Http\AbstractClientErrorException) {
             return true;
         }
-        // Only show errors in FE, if a BE user is authenticated
-        if (TYPO3_MODE === 'FE') {
-            return $GLOBALS['TSFE']->isBackendUserLoggedIn();
+        // Only show errors if a BE user is authenticated
+        if ($GLOBALS['BE_USER'] instanceof BackendUserAuthentication) {
+            return $GLOBALS['BE_USER']->user['uid'] > 0;
         }
-        return true;
+        return false;
     }
 
     /**