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/basic.php

    r42381 r45424  
    1414        $license = file_get_contents( ABSPATH . 'license.txt' );
    1515        preg_match( '#Copyright 2011-(\d+) by the contributors#', $license, $matches );
    16         $this_year = date( 'Y' );
     16        $this_year = gmdate( 'Y' );
    1717        $this->assertEquals( $this_year, trim( $matches[1] ), "license.txt's year needs to be updated to $this_year." );
    1818    }
Note: See TracChangeset for help on using the changeset viewer.