From 084a7b50cd5859bb1dd872f937c8014fac64cf59 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Fri, 7 Feb 2014 08:14:12 +0000 Subject: [PATCH] Use a float for last_changed microtime cache values. microtime() by default returns a string with a space, which isn't allowed for keys in some cache backends. props _jameslee, drozdz. fixes #27000. see #23448. Built from https://develop.svn.wordpress.org/trunk@27115 git-svn-id: http://core.svn.wordpress.org/trunk@26982 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/comment.php | 6 +++--- wp-includes/general-template.php | 2 +- wp-includes/post.php | 4 ++-- wp-includes/taxonomy.php | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/wp-includes/comment.php b/wp-includes/comment.php index 16bd29ea1e..72fef8bab1 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -280,7 +280,7 @@ class WP_Comment_Query { $key = md5( serialize( compact(array_keys($defaults)) ) ); $last_changed = wp_cache_get( 'last_changed', 'comment' ); if ( ! $last_changed ) { - $last_changed = microtime(); + $last_changed = microtime( true ); wp_cache_set( 'last_changed', $last_changed, 'comment' ); } $cache_key = "get_comments:$key:$last_changed"; @@ -1560,7 +1560,7 @@ function wp_insert_comment($commentdata) { */ do_action( 'wp_insert_comment', $id, $comment ); - wp_cache_set( 'last_changed', microtime(), 'comment' ); + wp_cache_set( 'last_changed', microtime( true ), 'comment' ); return $id; } @@ -2360,7 +2360,7 @@ function clean_comment_cache($ids) { foreach ( (array) $ids as $id ) wp_cache_delete($id, 'comment'); - wp_cache_set( 'last_changed', microtime(), 'comment' ); + wp_cache_set( 'last_changed', microtime( true ), 'comment' ); } /** diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php index 642aa722cf..ab4ad61c25 100644 --- a/wp-includes/general-template.php +++ b/wp-includes/general-template.php @@ -985,7 +985,7 @@ function wp_get_archives($args = '') { $last_changed = wp_cache_get( 'last_changed', 'posts' ); if ( ! $last_changed ) { - $last_changed = microtime(); + $last_changed = microtime( true ); wp_cache_set( 'last_changed', $last_changed, 'posts' ); } diff --git a/wp-includes/post.php b/wp-includes/post.php index 02cc7d5a5e..f6f10f197c 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -3749,7 +3749,7 @@ function get_pages( $args = array() ) { $key = md5( serialize( compact(array_keys($defaults)) ) ); $last_changed = wp_cache_get( 'last_changed', 'posts' ); if ( ! $last_changed ) { - $last_changed = microtime(); + $last_changed = microtime( true ); wp_cache_set( 'last_changed', $last_changed, 'posts' ); } @@ -4763,7 +4763,7 @@ function clean_post_cache( $post ) { do_action( 'clean_page_cache', $post->ID ); } - wp_cache_set( 'last_changed', microtime(), 'posts' ); + wp_cache_set( 'last_changed', microtime( true ), 'posts' ); } /** diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index b2336c8a59..34f7900426 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -1313,7 +1313,7 @@ function get_terms($taxonomies, $args = '') { $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"; @@ -2814,7 +2814,7 @@ function clean_term_cache($ids, $taxonomy = '', $clean_taxonomy = true) { set_taxonomy_last_changed( $taxonomy ); } - wp_cache_set( 'last_changed', microtime(), 'terms' ); + wp_cache_set( 'last_changed', microtime( true ), 'terms' ); } /**