Make WordPress Core

Opened 17 months ago

Last modified 17 months ago

#57835 new defect (bug)

class-wp-term-query.php no error checking

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

Description (last modified by sabernhardt)

Attempt to read property "count" on null in /wp-includes/class-wp-term-query.php on line 768.
Does not check for failure of get_term function. Causes very annoying PHP warnings.

Change History (4)

#1 @kebbet
17 months ago

  • Keywords reporter-feedback added

I can not find any call to count on line 768 in that file in trunk or 6.1. What version of WordPress is this issue present?

#2 @jakariaistauk
17 months ago

I also can not find any call to count on line 768 in that file in the trunk.

But I found some code about count on line 802. are you talking about that?

#3 @sabernhardt
17 months ago

  • Component changed from General to Taxonomy
  • Description modified (diff)

The 768 line number is more than two years old, but the condition still checks $child->count on the current line 844.

$child = get_term( $child_id, $term->taxonomy );
if ( $child->count ) {
  continue 2;

#4 @kebbet
17 months ago

How did you generate the warning @coleatkinson1?

Is there a way to generate the PHP-warning so a potential fix can be verified?

Note: See TracTickets for help on using tickets.