[wp-trac] [WordPress Trac] #55838: Warning: strip_tags() expects parameter 1 to be string, array given in wp-includes/formatting.php:2246

WordPress Trac noreply at wordpress.org
Tue Oct 11 13:24:04 UTC 2022


#55838: Warning: strip_tags() expects parameter 1 to be string, array given in wp-
includes/formatting.php:2246
-------------------------------+-----------------------
 Reporter:  dd32               |       Owner:  audrasjb
     Type:  defect (bug)       |      Status:  closed
 Priority:  normal             |   Milestone:  6.1
Component:  Posts, Post Types  |     Version:
 Severity:  normal             |  Resolution:  fixed
 Keywords:  has-patch commit   |     Focuses:  rest-api
-------------------------------+-----------------------
Changes (by audrasjb):

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


Comment:

 In [changeset:"54476" 54476]:
 {{{
 #!CommitTicketReference repository="" revision="54476"
 Posts, Post Types: Ensure all entries in the list returned by
 `wp_parse_list()` are scalar.

 This changeset fixes a warning where `strip_tags()` expected its first
 parameter to be a string rather than an array. It contains the following
 changes:

 - Removal of sanitize_callback to allow the REST API to handle the
 validation natively, this also causes the proper error to be output for
 `?slug[0][1]=2` that it's an invalid value.
 - Ensure that `wp_parse_list()` only returns a single-dimensioned array,
 even if passed a multi-dimension array, which fits the functions expected
 use case and resolves warnings in code that expects the function to return
 a single-dimensioned array.

 Props dd32, TimothyBlynJacobs.
 Fixes #55838.
 }}}

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


More information about the wp-trac mailing list