WordPress.org

Make WordPress Core


Ignore:
Timestamp:
05/26/2019 12:11:37 AM (2 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/rest-api/rest-users-controller.php

    r44642 r45424  
    27922792            $this->assertEquals( (object) $user->allcaps, $data['capabilities'] );
    27932793            $this->assertEquals( (object) $user->caps, $data['extra_capabilities'] );
    2794             $this->assertEquals( date( 'c', strtotime( $user->user_registered ) ), $data['registered_date'] );
     2794            $this->assertEquals( gmdate( 'c', strtotime( $user->user_registered ) ), $data['registered_date'] );
    27952795            $this->assertEquals( $user->user_login, $data['username'] );
    27962796            $this->assertEquals( $user->roles, $data['roles'] );
Note: See TracChangeset for help on using the changeset viewer.