🔧
This commit is contained in:
10
vendor/symfony/http-foundation/IpUtils.php
vendored
10
vendor/symfony/http-foundation/IpUtils.php
vendored
@@ -182,6 +182,16 @@ class IpUtils
|
||||
*/
|
||||
public static function anonymize(string $ip): string
|
||||
{
|
||||
/**
|
||||
* If the IP contains a % symbol, then it is a local-link address with scoping according to RFC 4007
|
||||
* In that case, we only care about the part before the % symbol, as the following functions, can only work with
|
||||
* the IP address itself. As the scope can leak information (containing interface name), we do not want to
|
||||
* include it in our anonymized IP data.
|
||||
*/
|
||||
if (str_contains($ip, '%')) {
|
||||
$ip = substr($ip, 0, strpos($ip, '%'));
|
||||
}
|
||||
|
||||
$wrappedIPv6 = false;
|
||||
if (str_starts_with($ip, '[') && str_ends_with($ip, ']')) {
|
||||
$wrappedIPv6 = true;
|
||||
|
||||
Reference in New Issue
Block a user