From 633dd2650eddc64152ff649a35581c9b2435fcdb Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Sun, 18 Sep 2022 16:11:53 -0700 Subject: [PATCH] DebugSubscriber - Fix activation check This subscriber only interjects if XDebug is configured with the suitable mode. To see if the mode is suitable, it consults `ini_get("xdebug.mode")`, but this is not quite right -- because the mode may be set other ways (eg `XDEBUG_MODE`). In XDebug 3.1+, you can get the true effective-mode by calling `xdebug_info`. See also: https://xdebug.org/docs/all_functions#xdebug_info --- Civi/API/Subscriber/DebugSubscriber.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Civi/API/Subscriber/DebugSubscriber.php b/Civi/API/Subscriber/DebugSubscriber.php index 0e6be75478..2e1f3ee718 100644 --- a/Civi/API/Subscriber/DebugSubscriber.php +++ b/Civi/API/Subscriber/DebugSubscriber.php @@ -37,7 +37,8 @@ class DebugSubscriber implements EventSubscriberInterface { break; case '3.': - $xdebugMode = explode(',', ini_get('xdebug.mode')); + $xdebugMode = version_compare($version, '3.1', '>=') + ? xdebug_info('mode') : explode(',', ini_get('xdebug.mode')); $this->enableStats = in_array('develop', $xdebugMode); break; -- 2.25.1