Skip to content

Commit

Permalink
[BUGFIX] Fix backend user check in ProductionExceptionHandler
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
bnf authored and susannemoog committed Feb 12, 2018
1 parent eaa28ad commit 3900c7a
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions typo3/sysext/core/Classes/Error/ProductionExceptionHandler.php
Expand Up @@ -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
{
Expand Down Expand Up @@ -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;
}

/**
Expand Down

0 comments on commit 3900c7a

Please sign in to comment.