[wp-trac] [WordPress Trac] #11530: logic errors in clean_term_cache()

WordPress Trac wp-trac at lists.automattic.com
Mon Dec 21 10:29:17 UTC 2009


#11530: logic errors in clean_term_cache()
-------------------------------+--------------------------------------------
 Reporter:  Denis-de-Bernardy  |       Owner:  westi    
     Type:  defect (bug)       |      Status:  accepted 
 Priority:  normal             |   Milestone:  2.9.1    
Component:  Taxonomy           |     Version:  2.9      
 Severity:  normal             |    Keywords:  has-patch
-------------------------------+--------------------------------------------

Comment(by Denis-de-Bernardy):

 @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:

 1. 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);
 }}}

 2. 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);
 }}}

 3. 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);
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/11530#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list