From b72334e97620733637d05048589b3ef94c7458a0 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Wed, 27 Nov 2024 11:38:10 +0000 Subject: [PATCH] Coding Standards: Cast `gmdate( 'Z' )` to an integer before addition. 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 --- src/wp-admin/includes/upgrade.php | 2 +- src/wp-includes/class-wp-date-query.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wp-admin/includes/upgrade.php b/src/wp-admin/includes/upgrade.php index 090a5f1853e6f..068e28b040e33 100644 --- a/src/wp-admin/includes/upgrade.php +++ b/src/wp-admin/includes/upgrade.php @@ -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(); diff --git a/src/wp-includes/class-wp-date-query.php b/src/wp-includes/class-wp-date-query.php index b8ae95461c1a9..76b70849493dd 100644 --- a/src/wp-includes/class-wp-date-query.php +++ b/src/wp-includes/class-wp-date-query.php @@ -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;