Skip to content

Commit

Permalink
Coding Standards: Cast gmdate( 'Z' ) to an integer before addition.
Browse files Browse the repository at this point in the history
This addresses two instances of the (numeric string) `gmdate( 'Z' )` being added to an `int` value.

Affected functions:
* `upgrade_110()`
* `WP_Date_Query::validate_date_values()`

Follow-up to [942], [29925], [45424].

Props justlevine.
See #52217.

git-svn-id: https://develop.svn.wordpress.org/trunk@59465 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
SergeyBiryukov committed Nov 27, 2024
1 parent 9840f03 commit b72334e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/wp-admin/includes/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,7 @@ function upgrade_110() {

$time_difference = $all_options->time_difference;

$server_time = time() + gmdate( 'Z' );
$server_time = time() + (int) gmdate( 'Z' );
$weblogger_time = $server_time + $time_difference * HOUR_IN_SECONDS;
$gmt_time = time();

Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/class-wp-date-query.php
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ public function validate_date_values( $date_query = array() ) {
$_year = $date_query['year'];
}

$max_days_of_year = gmdate( 'z', mktime( 0, 0, 0, 12, 31, $_year ) ) + 1;
$max_days_of_year = (int) gmdate( 'z', mktime( 0, 0, 0, 12, 31, $_year ) ) + 1;
} else {
// Otherwise we use the max of 366 (leap-year).
$max_days_of_year = 366;
Expand Down

0 comments on commit b72334e

Please sign in to comment.