Make WordPress Core


Ignore:
Timestamp:
05/26/2019 12:11:37 AM (6 years ago)
Author:
SergeyBiryukov
Message:

Date/Time: Replace all instances of date() with gmdate().

Use of date() in core depends on PHP timezone set to UTC and not changed by third party code (which cannot be guaranteed).

gmdate() is functionally equivalent, but is not affected by PHP timezone setting: it's always UTC, which is the exact behavior the core needs.

Props nielsdeblaauw, Rarst.
Fixes #46438. See #44491.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/query/stickies.php

    r42343 r45424  
    1313        $now = time();
    1414        for ( $i = 0; $i <= 22; $i++ ) {
    15             $post_date         = date( 'Y-m-d H:i:s', $now - ( 10 * $i ) );
     15            $post_date         = gmdate( 'Y-m-d H:i:s', $now - ( 10 * $i ) );
    1616            self::$posts[ $i ] = $factory->post->create(
    1717                array(
     
    2929        $q = new WP_Query(
    3030            array(
    31                 'year'           => date( 'Y' ),
     31                'year'           => gmdate( 'Y' ),
    3232                'fields'         => 'ids',
    3333                'posts_per_page' => 3,
Note: See TracChangeset for help on using the changeset viewer.