mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@45424 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -12,7 +12,7 @@ class Tests_Query_Stickies extends WP_UnitTestCase {
|
||||
// Set post times to get a reliable order.
|
||||
$now = time();
|
||||
for ( $i = 0; $i <= 22; $i++ ) {
|
||||
$post_date = date( 'Y-m-d H:i:s', $now - ( 10 * $i ) );
|
||||
$post_date = gmdate( 'Y-m-d H:i:s', $now - ( 10 * $i ) );
|
||||
self::$posts[ $i ] = $factory->post->create(
|
||||
array(
|
||||
'post_date' => $post_date,
|
||||
@@ -28,7 +28,7 @@ class Tests_Query_Stickies extends WP_UnitTestCase {
|
||||
public function test_stickies_should_be_ignored_when_is_home_is_false() {
|
||||
$q = new WP_Query(
|
||||
array(
|
||||
'year' => date( 'Y' ),
|
||||
'year' => gmdate( 'Y' ),
|
||||
'fields' => 'ids',
|
||||
'posts_per_page' => 3,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user