[wp-trac] [WordPress Trac] #43545: Helper functions: Anonymizing data in a standardized way

WordPress Trac noreply at wordpress.org
Fri Apr 6 10:23:01 UTC 2018


#43545: Helper functions: Anonymizing data in a standardized way
--------------------------------+--------------------
 Reporter:  dejliglama          |       Owner:
     Type:  enhancement         |      Status:  new
 Priority:  normal              |   Milestone:  5.0
Component:  Options, Meta APIs  |     Version:  trunk
 Severity:  normal              |  Resolution:
 Keywords:  needs-patch gdpr    |     Focuses:
--------------------------------+--------------------

Comment (by birgire):

 I was wondering about the current {{{0.0.0.0}}} output for an IPv6
 address.

 For example:

 {{{wp_privacy_anonymize_ip( '2001:db8:a0b:12f0::1' )}}} now outputs
 {{{'0.0.0.0'}}} when {{{inet_ntop()}}} or {{{inet_pton()}}} are not
 available.

 The unspecified address for IPv6 is {{{0:0:0:0:0:0:0:0}}} or {{{::}}}.

 Would {{{::}}} be expected in the above example?

 Some other suggestions for [attachment:43545.3.diff]:

 Make the tests aware of missing {{{inet_ntop()}}/{{{inet_pton()}}}
 functions, with e.g.

 {{{
 if ( ! function_exists( 'inet_ntop' ) ) {
         $this->markTestSkipped( 'inet_ntop extension not available.' );
 }
 if ( ! function_exists( 'inet_pton' ) ) {
         $this->markTestSkipped( 'inet_pton extension not available.' );
 }

 }}}

 or modify the expected value explicitly like:

 {{{
 if( function_exists( 'inet_ntop' ) && function_exists( 'inet_pton' ) ) {
     $expected = '...';
 } else {
     $expected = '0.0.0.0';
 }

 }}}

 Adjustments according to the ''Coding Standard''.

 Should we use data providers here instead of for loops?

--
Ticket URL: <https://core.trac.wordpress.org/ticket/43545#comment:26>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list