From 4883ea427c3987d4a72c2cb430411a7c1bd3d954 Mon Sep 17 00:00:00 2001 From: Kevin Pfeifer Date: Wed, 31 May 2023 21:06:45 +0200 Subject: [PATCH] fix warning in e.g. app tests when global is not present --- src/ToolbarService.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ToolbarService.php b/src/ToolbarService.php index fc548291..b77c272a 100644 --- a/src/ToolbarService.php +++ b/src/ToolbarService.php @@ -102,7 +102,13 @@ public function registry(): PanelRegistry */ public function isEnabled(): bool { - if (defined('PHPUNIT_COMPOSER_INSTALL') && !$GLOBALS['FORCE_DEBUGKIT_TOOLBAR']) { + if (!isset($GLOBALS['FORCE_DEBUGKIT_TOOLBAR'])) { + $GLOBALS['FORCE_DEBUGKIT_TOOLBAR'] = false; + } + if ( + defined('PHPUNIT_COMPOSER_INSTALL') && + !$GLOBALS['FORCE_DEBUGKIT_TOOLBAR'] + ) { return false; } $enabled = (bool)Configure::read('debug')