[wp-trac] [WordPress Trac] #41450: sanitize_text_field() assumes the field is a string

WordPress Trac noreply at wordpress.org
Mon Jan 28 09:05:20 UTC 2019

#41450: sanitize_text_field() assumes the field is a string
 Reporter:  johnbillion             |       Owner:  pento
     Type:  defect (bug)            |      Status:  reopened
 Priority:  low                     |   Milestone:  5.1
Component:  Formatting              |     Version:  2.9
 Severity:  normal                  |  Resolution:
 Keywords:  has-patch dev-feedback  |     Focuses:

Comment (by azaozz):

 > ...is used to sanitize text input, but the function actually assumes the
 field is a string.

 Right, a "text input" is always a string. This is clearly documented in
 the docblock :)

 I'm thinking this should be `wontfix`. A well-documented function
 expecting an argument of specific type should not be checking if that
 argument is actually of that type (unless we want to throw a "Doing it

 At most we can probably cast to a string to prevent warnings, although
 these warnings may be helpful to notice errors while developing plugins.

Ticket URL: <https://core.trac.wordpress.org/ticket/41450#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list