fix: [flood protection] default to 127.0.0.1 if no remote_addr is set as we're dealing with a local CLI script

pull/92/head
iglocska 2022-02-20 15:00:15 +01:00
parent c005cb7f66
commit e2bb58d3c7
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
1 changed files with 5 additions and 0 deletions

View File

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