When the query in taxonomy_term_count_nodes returns no rows, $count[$type] is never set. Therefore subsequent calls to this function for that type have to run the query again.
I don't have easy access to cvs and diff, so I'll roll a patch later today. The fix is one line before the while loop:
$count[$type] = array();
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | taxonomy_patch.diff | 770 bytes | Island Usurper |
Comments
Comment #1
Island Usurper commentedThe long awaited patch is here at last.
Comment #2
Island Usurper commentedUpdating to show that more people have noticed this bug. Duplicate issue found at #259243: Wrong cache of node count for taxonomy when count is 0 in function taxonomy_term_count_nodes()
Comment #3
drummCommitted to 5.x.
Applies to 6.x and HEAD, so needs to be committed there.
Comment #4
dries commentedCommitted to HEAD and DRUPAL-6.
Comment #5
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.