[wp-trac] [WordPress Trac] #60055: Array to string conversion warning after r50157

WordPress Trac noreply at wordpress.org
Wed May 14 01:30:18 UTC 2025


#60055: Array to string conversion warning after r50157
--------------------------+------------------------------
 Reporter:  dcavins       |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  REST API      |     Version:  6.4.2
 Severity:  minor         |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+------------------------------
Changes (by dd32):

 * keywords:  has-patch reporter-feedback => has-patch


Comment:

 This warning can also be triggered through a regular GET request, I
 suspect this is triggering a warning in the REST API request due to
 `WP::parse_request()` running on REST API requests, **and** a taxonomy
 with the query var `'categories'` being registered.

 The logic in [attachment:"60055.01.diff"] likely isn't needed here at all,
 IMHO, as the `categories` handling here isn't supposed to be reflected in
 the WP query being parsed.

 For example, with trunk:
 {{{
 GET https://example.org/?category_name[][]=releases

 PHP Warning:  Array to string conversion in wp-includes/class-wp.php on
 line 359
 PHP Stack trace:
 PHP   1. {main}() index.php:0
 PHP   2. require() index.php:18
 PHP   3. wp($query_vars = *uninitialized*) wp-blog-header.php:16
 PHP   4. WP->main($query_args = '') wp-includes/functions.php:1341
 PHP   5. WP->parse_request($extra_query_vars = '') wp-includes/class-
 wp.php:818
 PHP   6. str_replace($search = ' ', $replace = '+', $subject = [0 => [0 =>
 'release']]) wp-includes/class-wp.php:359
 }}}

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


More information about the wp-trac mailing list