Skip to content

Commit 8319ddf

Browse files
committed
minor #20433 [HttpFoundation] Do not use named parameters in example (MrYamous)
This PR was squashed before being merged into the 7.2 branch. Discussion ---------- [HttpFoundation] Do not use named parameters in example Noticed from [blog article ](https://symfony.com/blog/new-in-symfony-7-2-misc-improvements-part-2#better-ip-address-anonymization) The example in the blog seems to me to be the right one, parameters aren't actually implemented so using named paramets is not possible yet Commits ------- ec2743d [HttpFoundation] Do not use named parameters in example
2 parents bd7827a + ec2743d commit 8319ddf

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

components/http_foundation.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,11 +367,13 @@ of the ``anonymize()`` method to specify the number of bytes that should be
367367
anonymized depending on the IP address format::
368368

369369
$ipv4 = '123.234.235.236';
370-
$anonymousIpv4 = IpUtils::anonymize($ipv4, v4Bytes: 3);
370+
$anonymousIpv4 = IpUtils::anonymize($ipv4, 3);
371371
// $anonymousIpv4 = '123.0.0.0'
372372

373373
$ipv6 = '2a01:198:603:10:396e:4789:8e99:890f';
374-
$anonymousIpv6 = IpUtils::anonymize($ipv6, v6Bytes: 10);
374+
// (you must define the second argument (bytes to anonymize in IPv4 addresses)
375+
// even when you are only anonymizing IPv6 addresses)
376+
$anonymousIpv6 = IpUtils::anonymize($ipv6, 3, 10);
375377
// $anonymousIpv6 = '2a01:198:603::'
376378

377379
.. versionadded:: 7.2

0 commit comments

Comments
 (0)