From e2bb58d3c7cff4e5ebad7591e78c9c21d3950c55 Mon Sep 17 00:00:00 2001 From: iglocska Date: Sun, 20 Feb 2022 15:00:15 +0100 Subject: [PATCH] fix: [flood protection] default to 127.0.0.1 if no remote_addr is set as we're dealing with a local CLI script --- src/Controller/Component/FloodProtectionComponent.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Controller/Component/FloodProtectionComponent.php b/src/Controller/Component/FloodProtectionComponent.php index ff45590..a52c964 100644 --- a/src/Controller/Component/FloodProtectionComponent.php +++ b/src/Controller/Component/FloodProtectionComponent.php @@ -20,6 +20,11 @@ class FloodProtectionComponent extends Component if (!isset($_SERVER[$ip_source])) { $ip_source = 'REMOTE_ADDR'; } + if (isset($_SERVER[$ip_source])) { + $this->remote_ip = $_SERVER[$ip_source]; + } else { + $this->remote_ip = '127.0.0.1'; + } $this->remote_ip = $_SERVER[$ip_source]; $temp = explode(PHP_EOL, $_SERVER[$ip_source]); if (count($temp) > 1) {