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:
Sergey Biryukov
2019-05-26 00:11:37 +00:00
parent 716e25e0df
commit 10855438ea
49 changed files with 231 additions and 231 deletions

View File

@@ -16,7 +16,7 @@ class Tests_Comment_WpListComments extends WP_UnitTestCase {
$comments[] = self::factory()->comment->create(
array(
'comment_post_ID' => $p,
'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - $i ),
'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - $i ),
'comment_author' => 'Commenter ' . $i,
)
);
@@ -54,7 +54,7 @@ class Tests_Comment_WpListComments extends WP_UnitTestCase {
$comments[] = self::factory()->comment->create(
array(
'comment_post_ID' => $p,
'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - $i ),
'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - $i ),
'comment_author' => 'Commenter ' . $i,
)
);
@@ -92,7 +92,7 @@ class Tests_Comment_WpListComments extends WP_UnitTestCase {
$comments[] = self::factory()->comment->create(
array(
'comment_post_ID' => $p,
'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - $i ),
'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - $i ),
'comment_author' => 'Commenter ' . $i,
)
);
@@ -138,7 +138,7 @@ class Tests_Comment_WpListComments extends WP_UnitTestCase {
$comments[] = self::factory()->comment->create(
array(
'comment_post_ID' => $p,
'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - $i ),
'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - $i ),
'comment_author' => 'Commenter ' . $i,
)
);
@@ -178,7 +178,7 @@ class Tests_Comment_WpListComments extends WP_UnitTestCase {
$comments[] = self::factory()->comment->create(
array(
'comment_post_ID' => $p,
'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - $i ),
'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - $i ),
'comment_author' => 'Commenter ' . $i,
)
);
@@ -223,7 +223,7 @@ class Tests_Comment_WpListComments extends WP_UnitTestCase {
$comments[] = self::factory()->comment->create(
array(
'comment_post_ID' => $p,
'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - $i ),
'comment_date_gmt' => gmdate( 'Y-m-d H:i:s', $now - $i ),
'comment_author' => 'Commenter ' . $i,
'user_id' => $u,
)