[core] don't crash if TRUSTED_PROXIES isn't defined, fixes #1061

This commit is contained in:
Shish 2024-02-21 14:58:14 +00:00 committed by Shish
parent fa5f6b8179
commit 0890de35c1

View file

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