fix not existing component issue in admin panels login controller

This commit is contained in:
Daniel Seifert 2022-08-15 15:44:51 +02:00
bovenliggende 4b47e5ddb6
commit ff606efef3
Getekend door: DanielS
GPG sleutel-ID: 8A7C4C6ED1915C6F
2 gewijzigde bestanden met toevoegingen van 41 en 30 verwijderingen

Bestand weergeven

@ -36,7 +36,6 @@ class DebugBarExceptionHandler
*/ */
public function handleUncaughtException(Throwable $exception) public function handleUncaughtException(Throwable $exception)
{ {
//dumpvar(__METHOD__.__LINE__);
try { try {
$debugMode = (bool) \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Core\ConfigFile::class)->getVar('iDebug'); $debugMode = (bool) \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Core\ConfigFile::class)->getVar('iDebug');
$defaultExceptionHandler = new ExceptionHandler($debugMode); $defaultExceptionHandler = new ExceptionHandler($debugMode);
@ -56,11 +55,9 @@ class DebugBarExceptionHandler
} }
global $debugBarSet; global $debugBarSet;
if ($debugBarSet !== 1) { if ($debugBarSet !== 1 && false === isAdmin()) {
/** @var FrontendController $activeView */ /** @var DebugBarComponent $debugBarComponent */
$activeView = Registry::getConfig()->getTopActiveView(); $debugBarComponent = oxNew( DebugBarComponent::class );
/** @var DebugBarComponent|null $debugBarComponent */
$debugBarComponent = $activeView->getComponent(DebugBarComponent::class) ?: oxNew(DebugBarComponent::class);
/** @var ExceptionsCollector $excCollector */ /** @var ExceptionsCollector $excCollector */
$excCollector = $debugBarComponent->getDebugBar()->getCollector('exceptions'); $excCollector = $debugBarComponent->getDebugBar()->getCollector('exceptions');

Bestand weergeven

@ -42,6 +42,7 @@ class ShopControl_DebugBar extends ShopControl_DebugBar_parent
*/ */
public function d3DebugBarSetErrorHandler() public function d3DebugBarSetErrorHandler()
{ {
if ($this->d3CanActivateDebugBar()) {
set_error_handler( function( $severity, $message, $file, $line ) { set_error_handler( function( $severity, $message, $file, $line ) {
if ( ! ( error_reporting() & $severity ) ) { if ( ! ( error_reporting() & $severity ) ) {
// This error code is not included in error_reporting. // This error code is not included in error_reporting.
@ -56,17 +57,20 @@ class ShopControl_DebugBar extends ShopControl_DebugBar_parent
throw new ErrorException( $message, 0, $severity, $file, $line ); throw new ErrorException( $message, 0, $severity, $file, $line );
} ); } );
} }
}
/** /**
* @return void * @return void
*/ */
protected function d3DebugBarSetExceptionHandler(): void protected function d3DebugBarSetExceptionHandler(): void
{ {
if ($this->d3CanActivateDebugBar()) {
set_exception_handler( [ set_exception_handler( [
new DebugBarExceptionHandler(), new DebugBarExceptionHandler(),
'handleUncaughtException' 'handleUncaughtException'
] ); ] );
} }
}
/** /**
* @param $messsage * @param $messsage
@ -89,6 +93,7 @@ class ShopControl_DebugBar extends ShopControl_DebugBar_parent
*/ */
protected function d3AddDebugBarComponent(): void protected function d3AddDebugBarComponent(): void
{ {
if ($this->d3CanActivateDebugBar()) {
$userComponentNames = Registry::getConfig()->getConfigParam( 'aUserComponentNames' ); $userComponentNames = Registry::getConfig()->getConfigParam( 'aUserComponentNames' );
$d3CmpName = DebugBarComponent::class; $d3CmpName = DebugBarComponent::class;
$blDontUseCache = 1; $blDontUseCache = 1;
@ -102,6 +107,15 @@ class ShopControl_DebugBar extends ShopControl_DebugBar_parent
Registry::getConfig()->setConfigParam( 'aUserComponentNames', $userComponentNames ); Registry::getConfig()->setConfigParam( 'aUserComponentNames', $userComponentNames );
} }
} }
}
/**
* @return bool
*/
protected function d3CanActivateDebugBar(): bool
{
return false === isAdmin();
}
public function __destruct() public function __destruct()
{ {