Make WordPress Core

Ticket #61732: calendar_month.patch

File calendar_month.patch, 928 bytes (added by leedxw, 7 weeks ago)

Patch to ensure month value is valid

  • wp-includes/general-template.php

    From e04497be7907a8839834813f651b38f353a47ff9 Mon Sep 17 00:00:00 2001
    From: Lee Maguire <lee@dxw.com>
    Date: Tue, 23 Jul 2024 18:14:39 +0100
    Subject: [PATCH] Ensure month is in the range 01 to 12
    
    If the variable `$thismonth` contains a value other than a valid month,
    the subsequent SQL query will raise an error.
    ---
     wp-includes/general-template.php | 3 +++
     1 file changed, 3 insertions(+)
    
    diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php
    index bf70defd..6e63a8d1 100644
    a b function get_calendar( $initial = true, $display = true ) { 
    23002300                        $thismonth = '01';
    23012301                } else {
    23022302                        $thismonth = zeroise( (int) substr( $m, 4, 2 ), 2 );
     2303                        if ( ! in_array( (int) $thismonth, range(1,12) ) ) {
     2304                                $thismonth = '01';
     2305                        }
    23032306                }
    23042307        } else {
    23052308                $thisyear  = current_time( 'Y' );