[wp-trac] [WordPress Trac] #16867: Where is it appropriate to use filter_var

WordPress Trac noreply at wordpress.org
Thu Dec 17 04:13:59 UTC 2015


#16867: Where is it appropriate to use filter_var
-------------------------------------------------+-------------------------
 Reporter:  aaroncampbell                        |       Owner:
     Type:  enhancement                          |      Status:  reopened
 Priority:  normal                               |   Milestone:  Future
Component:  General                              |  Release
 Severity:  normal                               |     Version:  3.2
 Keywords:  westi-likes needs-patch dev-         |  Resolution:
  feedback                                       |     Focuses:
-------------------------------------------------+-------------------------

Comment (by dd32):

 Unless there's a method that is called often, I'd far prefer to just have
 our own implementation in use so as to be sure that any bugs in our
 implementation is found.

 Branching in a sanitize/checking function such as `WP_HTTP::is_ip_address`
 based on the existence of `filter_var()` seems like a bad idea overall,
 not only does our sanitization then have to match whatever `filter_var()`
 does, but it's also likely to cause our code to be non-unit-testable (I
 know there's ways around that by using multiple methods, but that's more
 unreadable).

 So count that as a -1 from me until the time where we can reliable rely
 upon `filter_var()` being present, and without any of the various bugs
 which have plagued the function in it's early days.

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


More information about the wp-trac mailing list