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. Built from https://develop.svn.wordpress.org/trunk@45424 git-svn-id: http://core.svn.wordpress.org/trunk@45235 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -337,7 +337,7 @@ function get_lastcommentmodified( $timezone = 'server' ) {
|
||||
$comment_modified_date = $wpdb->get_var( "SELECT comment_date FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 1" );
|
||||
break;
|
||||
case 'server':
|
||||
$add_seconds_server = date( 'Z' );
|
||||
$add_seconds_server = gmdate( 'Z' );
|
||||
|
||||
$comment_modified_date = $wpdb->get_var( $wpdb->prepare( "SELECT DATE_ADD(comment_date_gmt, INTERVAL %s SECOND) FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 1", $add_seconds_server ) );
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user