Make WordPress Core


Ignore:
Timestamp:
05/26/2019 12:11:37 AM (7 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/admin/includesPost.php

    r44959 r45424  
    356356                $this->set_permalink_structure( "/$permalink_structure/" );
    357357
    358                 $future_date = date( 'Y-m-d H:i:s', time() + 100 );
     358                $future_date = gmdate( 'Y-m-d H:i:s', time() + 100 );
    359359                $p           = self::factory()->post->create(
    360360                        array(
     
    378378                wp_set_current_user( self::$admin_id );
    379379
    380                 $future_date = date( 'Y-m-d H:i:s', time() + 100 );
     380                $future_date = gmdate( 'Y-m-d H:i:s', time() + 100 );
    381381                $p           = self::factory()->post->create(
    382382                        array(
     
    401401                wp_set_current_user( self::$admin_id );
    402402
    403                 $future_date = date( 'Y-m-d H:i:s', time() + 100 );
     403                $future_date = gmdate( 'Y-m-d H:i:s', time() + 100 );
    404404                $p           = self::factory()->post->create(
    405405                        array(
     
    465465
    466466                // Scheduled posts should use published permalink
    467                 $future_date = date( 'Y-m-d H:i:s', time() + 100 );
     467                $future_date = gmdate( 'Y-m-d H:i:s', time() + 100 );
    468468                $p           = self::factory()->post->create(
    469469                        array(
     
    508508                wp_set_current_user( self::$admin_id );
    509509
    510                 $future_date = date( 'Y-m-d H:i:s', time() + 100 );
     510                $future_date = gmdate( 'Y-m-d H:i:s', time() + 100 );
    511511                $p           = self::factory()->post->create(
    512512                        array(
Note: See TracChangeset for help on using the changeset viewer.