Correctly handle IP addresses containing RFC 4007 scoping

This commit is contained in:
Jan Böhmer 2024-12-01 19:19:04 +01:00
parent c7bf843312
commit baf8977578
5 changed files with 100 additions and 6 deletions

View file

@ -22,8 +22,9 @@ declare(strict_types=1);
namespace App\Entity\LogSystem;
use App\Helpers\IPAnonymizer;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\IpUtils;
/**
* This log entry is created when a user logs in.
@ -59,7 +60,7 @@ class UserLoginLogEntry extends AbstractLogEntry
public function setIPAddress(string $ip, bool $anonymize = true): self
{
if ($anonymize) {
$ip = IpUtils::anonymize($ip);
$ip = IPAnonymizer::anonymize($ip);
}
$this->extra['i'] = $ip;