From 99da253b4e693ca02fd4143ddde4037167b327a6 Mon Sep 17 00:00:00 2001 From: Dovid Levine Date: Tue, 19 Nov 2024 10:51:24 +0200 Subject: [PATCH] fix: cast `gmdate( 'w' )` to `int` before using as integer --- src/wp-includes/functions.php | 2 +- src/wp-includes/general-template.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php index d9303083bfaa9..3b75348c8c067 100644 --- a/src/wp-includes/functions.php +++ b/src/wp-includes/functions.php @@ -594,7 +594,7 @@ function get_weekstartend( $mysqlstring, $start_of_week = '' ) { $day = mktime( 0, 0, 0, $md, $mm, $my ); // The day of the week from the timestamp. - $weekday = gmdate( 'w', $day ); + $weekday = (int) gmdate( 'w', $day ); if ( ! is_numeric( $start_of_week ) ) { $start_of_week = get_option( 'start_of_week' ); diff --git a/src/wp-includes/general-template.php b/src/wp-includes/general-template.php index 1d9fc98b843f7..e96f0f7c37429 100644 --- a/src/wp-includes/general-template.php +++ b/src/wp-includes/general-template.php @@ -2373,7 +2373,7 @@ function get_calendar( $initial = true, $display = true ) { } // See how much we should pad in the beginning. - $pad = calendar_week_mod( gmdate( 'w', $unixmonth ) - $week_begins ); + $pad = calendar_week_mod( (int) gmdate( 'w', $unixmonth ) - $week_begins ); if ( 0 != $pad ) { $calendar_output .= "\n\t\t" . ' '; } @@ -2412,12 +2412,12 @@ function get_calendar( $initial = true, $display = true ) { $calendar_output .= ''; - if ( 6 == calendar_week_mod( gmdate( 'w', mktime( 0, 0, 0, $thismonth, $day, $thisyear ) ) - $week_begins ) ) { + if ( 6 == calendar_week_mod( (int) gmdate( 'w', mktime( 0, 0, 0, $thismonth, $day, $thisyear ) ) - $week_begins ) ) { $newrow = true; } } - $pad = 7 - calendar_week_mod( gmdate( 'w', mktime( 0, 0, 0, $thismonth, $day, $thisyear ) ) - $week_begins ); + $pad = 7 - calendar_week_mod( (int) gmdate( 'w', mktime( 0, 0, 0, $thismonth, $day, $thisyear ) ) - $week_begins ); if ( 0 != $pad && 7 != $pad ) { $calendar_output .= "\n\t\t" . ' '; }