From eaea8e664078db55dd32dd227bad34acb6c46229 Mon Sep 17 00:00:00 2001
From: Dag <me@dvikan.no>
Date: Sat, 15 Jul 2023 21:16:23 +0200
Subject: [PATCH] fix: Undefined index: REMOTE_ADDR in non-web sapi' (#3538)

---
 lib/Debug.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/Debug.php b/lib/Debug.php
index f6a8d105..48dbb31a 100644
--- a/lib/Debug.php
+++ b/lib/Debug.php
@@ -7,7 +7,7 @@ class Debug
      */
     public static function isEnabled(): bool
     {
-        $ip = $_SERVER['REMOTE_ADDR'];
+        $ip = $_SERVER['REMOTE_ADDR'] ?? 'x.y.z.1';
         $enableDebugMode = Configuration::getConfig('system', 'enable_debug_mode');
         $debugModeWhitelist = Configuration::getConfig('system', 'debug_mode_whitelist') ?: [];
         if ($enableDebugMode && ($debugModeWhitelist === [] || in_array($ip, $debugModeWhitelist))) {