[wp-trac] [WordPress Trac] #27000: taxonomy bug with microtime
WordPress Trac
noreply at wordpress.org
Mon Feb 3 18:33:27 UTC 2014
#27000: taxonomy bug with microtime
--------------------------+-----------------------------
Reporter: _jameslee | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Taxonomy | Version: 3.8.1
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
in the ~/wp_includes/taxonomy->get_terms() function
the $last_changed if it was not set, it gets set to what ever the
microtime() is at that moment. previous versions of this file it was
time(), unless you call microtime with the bool of true, you will get a
space in between the "msec sec". now this is fine and dandy, but if you
are running memcached as your caching device, the space in the cache key
causes all sort of weird things to happen.
here's my diff for this file.
{{{
Index: taxonomy.php
===================================================================
--- taxonomy.php (revision 26930)
+++ taxonomy.php (working copy)
@@ -1313,7 +1313,7 @@
$key = md5( serialize( compact(array_keys($defaults)) ) .
serialize( $taxonomies ) . $filter_key );
$last_changed = wp_cache_get( 'last_changed', 'terms' );
if ( ! $last_changed ) {
- $last_changed = microtime();
+ $last_changed = microtime(true);
wp_cache_set( 'last_changed', $last_changed, 'terms' );
}
$cache_key = "get_terms:$key:$last_changed";
}}}
Can someone please also update the docblock as well? it has had changes
since version 2.3
--
Ticket URL: <https://core.trac.wordpress.org/ticket/27000>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list