fix: Undefined index: REMOTE_ADDR in non-web sapi' (#3538)

This commit is contained in:
Dag 2023-07-15 21:16:23 +02:00 committed by GitHub
parent e5729fdaac
commit eaea8e6640
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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))) {