[wp-trac] [WordPress Trac] #57835: class-wp-term-query.php no error checking

WordPress Trac noreply at wordpress.org
Thu Mar 2 15:34:33 UTC 2023


#57835: class-wp-term-query.php no error checking
-------------------------------+------------------------------
 Reporter:  coleatkinson1      |       Owner:  (none)
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Taxonomy           |     Version:
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:
-------------------------------+------------------------------
Changes (by sabernhardt):

 * component:  General => Taxonomy


Old description:

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

New description:

 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.

--

Comment:

 The [https://core.trac.wordpress.org/browser/trunk/src/wp-includes/class-
 wp-term-query.php?rev=49946#L768 768 line number] is more than two years
 old, but the condition still checks `$child->count` on the
 [https://core.trac.wordpress.org/browser/trunk/src/wp-includes/class-wp-
 term-query.php?rev=55083#L844 current line 844].
 {{{
 $child = get_term( $child_id, $term->taxonomy );
 if ( $child->count ) {
   continue 2;
 }
 }}}

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


More information about the wp-trac mailing list