[wp-trac] [WordPress Trac] #41867: wp_list_categories throws SQL error if list is empty
WordPress Trac
noreply at wordpress.org
Thu Feb 21 03:13:45 UTC 2019
#41867: wp_list_categories throws SQL error if list is empty
-------------------------------+------------------------------
Reporter: firebird75 | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Taxonomy | Version: 4.8.1
Severity: normal | Resolution:
Keywords: reporter-feedback | Focuses:
-------------------------------+------------------------------
Comment (by boonebgorges):
Looking at the format of the query involved, it appear that it's coming
from `_pad_term_counts()`:
https://core.trac.wordpress.org/browser/tags/5.0.3/src/wp-
includes/taxonomy.php?marks=3359#L3335
In this location, I'm only able to trigger the error by passing either an
empty array or an array that only contains things that aren't `WP_Term`
objects to `_pad_term_counts()`. `_pad_term_counts()`, for its part, is
called just once in WP, by `WP_Term_Query`. It should never receive an
empty array in this instance, since empty `$terms` array cause the method
to return early. See
https://core.trac.wordpress.org/browser/tags/5.0.3/src/wp-includes/class-
wp-term-query.php?marks=699-702,716#L696 So it must be that `$terms`
passed to this function are not `WP_Term` objects. Perhaps this is a
result of a corrupted `'terms'` cache?
I suspect that `_pad_term_counts()` is being called by
--
Ticket URL: <https://core.trac.wordpress.org/ticket/41867#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list