[wp-trac] [WordPress Trac] #34659: Whitelist for validation functions which only accept one argument

WordPress Trac noreply at wordpress.org
Wed Feb 10 02:07:24 UTC 2016


#34659: Whitelist for validation functions which only accept one argument
------------------------------------------------+--------------------------
 Reporter:  danielbachhuber                     |       Owner:  rmccue
     Type:  defect (bug)                        |      Status:  assigned
 Priority:  normal                              |   Milestone:  Future
Component:  REST API                            |  Release
 Severity:  normal                              |     Version:
 Keywords:  has-patch has-unit-tests 4.5-early  |  Resolution:
                                                |     Focuses:
------------------------------------------------+--------------------------

Comment (by brianhogg):

 Since we can't go back on having validate_callback and sanitize_callback
 functions being passed 3 parameters without breaking things for those that
 are using them, whitelisting core WP and PHP functions that either return
 a different value then when passed just the argument value or throws a
 warning seems like the only reasonable approach.  Functions like
 strip_tags also return NULL when passed 3 parameters.

 The only alternative I see is doing some kind of reflection to only pass
 in the number of parameters a function accepts, which would likely cause
 performance issues and be unnecessary (and undesired) for functions that
 dynamically fetch arguments.

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


More information about the wp-trac mailing list