[wp-trac] [WordPress Trac] #41083: IP with port number triggers warnings in WP_Community_Events

WordPress Trac noreply at wordpress.org
Tue Aug 29 20:09:07 UTC 2017


#41083: IP with port number triggers warnings in WP_Community_Events
--------------------------------------+-----------------------------
 Reporter:  EatonZ                    |       Owner:  iandunn
     Type:  defect (bug)              |      Status:  assigned
 Priority:  normal                    |   Milestone:  4.9
Component:  Administration            |     Version:  4.8
 Severity:  normal                    |  Resolution:
 Keywords:  good-first-bug has-patch  |     Focuses:  administration
--------------------------------------+-----------------------------

Comment (by iandunn):

 Replying to [comment:4 iandunn]:
 > there might be a logic error in the loop...

 Part of the problem is that it's using `$_GET` instead of `$_SERVER`, but
 there's still another problem I haven't tracked down yet.

 > I used `filter_var` in `get_unsafe_client_ip()`, because it felt too
 fragile to rely on regex, `strpos`, etc...

 [https://3v4l.org/jQppQ parse_url() almost works for both IPv4 and IPv6
 addresses all the way back to 5.2.4], as long as a scheme is prepended
 (see [https://bugs.php.net/bug.php?id=72811 #72811-php]). With a little
 cajoling, it might work for IPv6 addresses that don't have ports. If it
 can, that'd probably be simpler and more compatible than `filter_var()`.

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


More information about the wp-trac mailing list