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/src/wp-admin/includes/dashboard.php

    r45298 r45424  
    864864
    865865            $time = get_the_time( 'U' );
    866             if ( date( 'Y-m-d', $time ) == $today ) {
     866            if ( gmdate( 'Y-m-d', $time ) == $today ) {
    867867                $relative = __( 'Today' );
    868             } elseif ( date( 'Y-m-d', $time ) == $tomorrow ) {
     868            } elseif ( gmdate( 'Y-m-d', $time ) == $tomorrow ) {
    869869                $relative = __( 'Tomorrow' );
    870             } elseif ( date( 'Y', $time ) !== $year ) {
     870            } elseif ( gmdate( 'Y', $time ) !== $year ) {
    871871                /* translators: date and time format for recent posts on the dashboard, from a different calendar year, see https://secure.php.net/date */
    872872                $relative = date_i18n( __( 'M jS Y' ), $time );
Note: See TracChangeset for help on using the changeset viewer.