WordPress.org

Make WordPress Core

Changeset 27115


Ignore:
Timestamp:
02/07/2014 08:13:37 AM (7 years ago)
Author:
nacin
Message:

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.

Location:
trunk/src/wp-includes
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/comment.php

    r27057 r27115  
    281281        $last_changed = wp_cache_get( 'last_changed', 'comment' );
    282282        if ( ! $last_changed ) {
    283             $last_changed = microtime();
     283            $last_changed = microtime( true );
    284284            wp_cache_set( 'last_changed', $last_changed, 'comment' );
    285285        }
     
    15611561    do_action( 'wp_insert_comment', $id, $comment );
    15621562
    1563     wp_cache_set( 'last_changed', microtime(), 'comment' );
     1563    wp_cache_set( 'last_changed', microtime( true ), 'comment' );
    15641564
    15651565    return $id;
     
    23612361        wp_cache_delete($id, 'comment');
    23622362
    2363     wp_cache_set( 'last_changed', microtime(), 'comment' );
     2363    wp_cache_set( 'last_changed', microtime( true ), 'comment' );
    23642364}
    23652365
  • trunk/src/wp-includes/general-template.php

    r27111 r27115  
    986986    $last_changed = wp_cache_get( 'last_changed', 'posts' );
    987987    if ( ! $last_changed ) {
    988         $last_changed = microtime();
     988        $last_changed = microtime( true );
    989989        wp_cache_set( 'last_changed', $last_changed, 'posts' );
    990990    }
  • trunk/src/wp-includes/post.php

    r27081 r27115  
    37503750    $last_changed = wp_cache_get( 'last_changed', 'posts' );
    37513751    if ( ! $last_changed ) {
    3752         $last_changed = microtime();
     3752        $last_changed = microtime( true );
    37533753        wp_cache_set( 'last_changed', $last_changed, 'posts' );
    37543754    }
     
    47644764    }
    47654765
    4766     wp_cache_set( 'last_changed', microtime(), 'posts' );
     4766    wp_cache_set( 'last_changed', microtime( true ), 'posts' );
    47674767}
    47684768
  • trunk/src/wp-includes/taxonomy.php

    r27108 r27115  
    13141314    $last_changed = wp_cache_get( 'last_changed', 'terms' );
    13151315    if ( ! $last_changed ) {
    1316         $last_changed = microtime();
     1316        $last_changed = microtime( true );
    13171317        wp_cache_set( 'last_changed', $last_changed, 'terms' );
    13181318    }
     
    28152815    }
    28162816
    2817     wp_cache_set( 'last_changed', microtime(), 'terms' );
     2817    wp_cache_set( 'last_changed', microtime( true ), 'terms' );
    28182818}
    28192819
Note: See TracChangeset for help on using the changeset viewer.