mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 15:50:09 +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:
@@ -2949,25 +2949,25 @@ class Tests_Comment_Query extends WP_UnitTestCase {
|
||||
$c1 = self::factory()->comment->create(
|
||||
array(
|
||||
'comment_post_ID' => self::$post_id,
|
||||
'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 50 ),
|
||||
'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 50 ),
|
||||
)
|
||||
);
|
||||
$c2 = self::factory()->comment->create(
|
||||
array(
|
||||
'comment_post_ID' => self::$post_id,
|
||||
'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 40 ),
|
||||
'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 40 ),
|
||||
)
|
||||
);
|
||||
$c3 = self::factory()->comment->create(
|
||||
array(
|
||||
'comment_post_ID' => self::$post_id,
|
||||
'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 30 ),
|
||||
'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 30 ),
|
||||
)
|
||||
);
|
||||
$c4 = self::factory()->comment->create(
|
||||
array(
|
||||
'comment_post_ID' => self::$post_id,
|
||||
'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 20 ),
|
||||
'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 20 ),
|
||||
)
|
||||
);
|
||||
|
||||
@@ -2995,25 +2995,25 @@ class Tests_Comment_Query extends WP_UnitTestCase {
|
||||
$c1 = self::factory()->comment->create(
|
||||
array(
|
||||
'comment_post_ID' => self::$post_id,
|
||||
'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 50 ),
|
||||
'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 50 ),
|
||||
)
|
||||
);
|
||||
$c2 = self::factory()->comment->create(
|
||||
array(
|
||||
'comment_post_ID' => self::$post_id,
|
||||
'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 40 ),
|
||||
'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 40 ),
|
||||
)
|
||||
);
|
||||
$c3 = self::factory()->comment->create(
|
||||
array(
|
||||
'comment_post_ID' => self::$post_id,
|
||||
'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 30 ),
|
||||
'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 30 ),
|
||||
)
|
||||
);
|
||||
$c4 = self::factory()->comment->create(
|
||||
array(
|
||||
'comment_post_ID' => self::$post_id,
|
||||
'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 20 ),
|
||||
'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - 20 ),
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user