[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
Mon Oct 10 20:58: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:  assigned
 Priority:  normal             |   Milestone:  6.1
Component:  Posts, Post Types  |     Version:
 Severity:  normal             |  Resolution:
 Keywords:  has-patch commit   |     Focuses:  rest-api
-------------------------------+-----------------------
Changes (by audrasjb):

 * keywords:  has-patch => has-patch commit
 * owner:  (none) => audrasjb
 * status:  new => assigned


Comment:

 I tested the PR using the following endpoint: `/wp-
 json/wp/v2/posts?slug[0][1]=2`

 Before patch:
 {{{
 <br />
 <b>Warning</b>:  preg_match() expects parameter 2 to be string, array
 given in <b>/wp-includes/formatting.php</b> on line <b>1596</b><br />
 <br />
 <b>Warning</b>:  strip_tags() expects parameter 1 to be string, array
 given in <b>/wp-includes/formatting.php</b> on line <b>2256</b><br />
 []
 }}}

 After patch:
 {{{
 {"code":"rest_invalid_param","message":"Invalid parameter(s):
 slug","data":{"status":400,"params":{"slug":"slug[0] is not of type
 string."},"details":{"slug":{"code":"rest_invalid_type","message":"slug[0]
 is not of type string.","data":{"param":"slug[0]"}}}}}
 }}}

 Looks like it fixes the issue.
 Self assigning for `commit`.

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


More information about the wp-trac mailing list