Opened 3 years ago
Closed 3 years ago
#11530 closed defect (bug) (fixed)
logic errors in clean_term_cache()
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 3.0 |
| Component: | Taxonomy | Version: | 2.9 |
| Severity: | normal | Keywords: | has-patch |
| Cc: |
Description (last modified by westi)
clean_term_cache() has a completely random behaviour.
the attached patch ensures that it behaves consistently.
Attachments (1)
Change History (10)
Denis-de-Bernardy — 3 years ago
- Description modified (diff)
- Owner changed from filosofo to westi
- Status changed from new to accepted
Have you got some example plugin code we can use to test this and reproduce the issue so that more people can test the fix?
Can you also explain which part is the Complelely random section? I'm guessing its the Action args?
Also, What was the point of this over the original, It doesnt add anything extra..
$taxonomies = array($taxonomy);
foreach ( $taxonomies as $taxonomy ) {
foreach ( $ids as $id ) {
wp_cache_delete($id, $taxonomy);
}
}
@westi: no working example, I merely ran into it while looking into improving a flush() function for memcached. please look at the code as it currently is.
the clean_terms_cache() accepts term_ids or term_taxonomy_ids as the first argument, and a taxonomy or an array of taxonomies as the second argument. use cases:
- one taxonomy provided, array of t_ids given. it does exactly what it should, i.e. deletes the cache properly, and ends up calling:
do_action('clean_term_cache', $t_ids, $taxonomy);
- no taxonomy provided, array of tt_ids given. it deletes the cache properly, but ends up calling the clean_term_cache action with tt_ids:
do_action('clean_term_cache', $tt_ids, $last_taxonomy_looped);
- multiple taxonomies provided, array of t_ids given. then this deletes nothing (it's an invalid bucket):
wp_cache_delete($id, $taxonomy);
and the concluding do_action amounts to:
do_action('clean_term_cache', $t_ids, $last_taxonomy_looped);
- Milestone changed from 2.9.1 to 3.0
Setting the milestone to 3.0 for now as that is where the changes so far have been committed.
In my eyes it looks like that the patch was comitted but the ticket is still open. How to continue? Close the ticket? Keep it open?
- Resolution set to fixed
- Status changed from accepted to closed

see also #11531