From 0890de35c1abf2c7ffde76050f0d954f56aa7da0 Mon Sep 17 00:00:00 2001 From: Shish Date: Wed, 21 Feb 2024 14:58:14 +0000 Subject: [PATCH] [core] don't crash if TRUSTED_PROXIES isn't defined, fixes #1061 --- core/util.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/util.php b/core/util.php index 05c58474..b237e4a4 100644 --- a/core/util.php +++ b/core/util.php @@ -151,6 +151,9 @@ function check_im_version(): int function is_trusted_proxy(): bool { $ra = $_SERVER['REMOTE_ADDR'] ?? "0.0.0.0"; + if(!defined("TRUSTED_PROXIES")) { + return false; + } // @phpstan-ignore-next-line - TRUSTED_PROXIES is defined in config foreach(TRUSTED_PROXIES as $proxy) { if(ip_in_range($ra, $proxy)) {