Make WordPress Core

Opened 3 weeks ago

Last modified 3 weeks ago

#63619 new defect (bug)

Cached WP_Term_Query result attempts object conversion to int

Reported by: crstauf's profile crstauf Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Query Keywords: reporter-feedback
Focuses: Cc:

Description

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.

Change History (2)

This ticket was mentioned in Slack in #core-test by oglekler. View the logs.


3 weeks ago

#2 @SirLouen
3 weeks ago

  • Keywords reporter-feedback added

@crstauf sometimes, we find errors in the code that are mostly obvious.

But still, we need a reproducible scenario for further testing them before starting to go hands on them. We have to try to build not only a patch, but some unit tests etc.

From what I can see, it appears that this might be executed by some dangling query var you have available. I'm not 100% confident, but probably coming from a plugin (or not, but we must find out).

My recommendation is to add some code there, in the line you see the problem is caused, like some traceback function and see where is coming this execution from. As I say, without a use case or something we can easily replicate this, it's going to be difficult to move forward this report.

Note: See TracTickets for help on using tickets.