[core] don't crash if TRUSTED_PROXIES isn't defined, fixes #1061
This commit is contained in:
parent
fa5f6b8179
commit
0890de35c1
1 changed files with 3 additions and 0 deletions
|
@ -151,6 +151,9 @@ function check_im_version(): int
|
||||||
function is_trusted_proxy(): bool
|
function is_trusted_proxy(): bool
|
||||||
{
|
{
|
||||||
$ra = $_SERVER['REMOTE_ADDR'] ?? "0.0.0.0";
|
$ra = $_SERVER['REMOTE_ADDR'] ?? "0.0.0.0";
|
||||||
|
if(!defined("TRUSTED_PROXIES")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
// @phpstan-ignore-next-line - TRUSTED_PROXIES is defined in config
|
// @phpstan-ignore-next-line - TRUSTED_PROXIES is defined in config
|
||||||
foreach(TRUSTED_PROXIES as $proxy) {
|
foreach(TRUSTED_PROXIES as $proxy) {
|
||||||
if(ip_in_range($ra, $proxy)) {
|
if(ip_in_range($ra, $proxy)) {
|
||||||
|
|
Reference in a new issue