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

WordPress Trac noreply at wordpress.org
Fri Jan 25 10:29:14 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:
------------------------------------+-----------------------
Changes (by jadpm):

 * status:  closed => reopened
 * resolution:  fixed =>


Comment:

 I kindly ask to revert this change as it has unexpected side effects that
 can potentially affect a great number of plugins.

 If I get the chain right, `sanitize_text_field` calls
 `_sanitize_text_fields` which calls `wp_check_invalid_utf8`, and this last
 one does a casting to string on the variable passed. I would suggest
 providing more data about the PHP errors that happen when passing an
 array, if any, and if so finding alternatives that do not introduce
 breaking chnages.

 The change introduced here will make that any boolean sanitized with this
 function becomes `false` by design, which is unexpected and a breaking
 change that can have a potentially huge impact.

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


More information about the wp-trac mailing list