[wp-trac] [WordPress Trac] #63619: Cached WP_Term_Query result attempts object conversion to int

WordPress Trac noreply at wordpress.org
Tue Jun 24 13:37:16 UTC 2025


#63619: Cached WP_Term_Query result attempts object conversion to int
--------------------------+-----------------------------
 Reporter:  crstauf       |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Query         |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 So far I have been unable to replicate this locally, but this error is
 repeated dozens of times in the error log on WP VIP:

 {{{
 Object of class WP_Term could not be converted to int in /var/www/wp-
 includes/class-wp-term-query.php on line 785
 }}}

 https://github.com/WordPress/wordpress-
 develop/blob/b3b04e423f01b004e1c598fdd934650c6b203056/src/wp-includes
 /class-wp-term-query.php#L785

 The cache key generation discards the `fields` parameter (`all` is used in
 most cases), which means that the cached value may be an array of objects,
 and then `intval` is applied to that array, which cannot be completed.

 I think the solution here is to check the cached array for the type of
 data, manipulate it if necessary, then run `intval` across the array.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/63619>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list