From 3900c7aec8ccb748246bddc5ed7bd69f5d08672a Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Mon, 12 Feb 2018 21:49:40 +0100 Subject: [PATCH] [BUGFIX] Fix backend user check in ProductionExceptionHandler MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Christian Kuhn Tested-by: Christian Kuhn Reviewed-by: Susanne Moog Tested-by: Susanne Moog --- .../Classes/Error/ProductionExceptionHandler.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/typo3/sysext/core/Classes/Error/ProductionExceptionHandler.php b/typo3/sysext/core/Classes/Error/ProductionExceptionHandler.php index 61a3b72234da..fb9e6e000057 100644 --- a/typo3/sysext/core/Classes/Error/ProductionExceptionHandler.php +++ b/typo3/sysext/core/Classes/Error/ProductionExceptionHandler.php @@ -13,14 +13,15 @@ * * 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 @@ protected function discloseExceptionInformation(\Throwable $exception) 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; } /**