[wp-trac] [WordPress Trac] #41011: get_calendar generates query with invalid date formats

WordPress Trac noreply at wordpress.org
Tue Jul 29 03:36:17 UTC 2025


#41011: get_calendar generates query with invalid date formats
----------------------------------------+-----------------------
 Reporter:  andy                        |       Owner:  pbearne
     Type:  defect (bug)                |      Status:  assigned
 Priority:  normal                      |   Milestone:  6.9
Component:  Date/Time                   |     Version:
 Severity:  normal                      |  Resolution:
 Keywords:  has-patch needs-unit-tests  |     Focuses:
----------------------------------------+-----------------------
Changes (by rollybueno):

 * keywords:  has-patch has-unit-tests => has-patch needs-unit-tests


Comment:

 Re: Unit test - https://github.com/WordPress/wordpress-
 develop/pull/8064/files#diff-
 754277583aa19c1f49a5f5cdf9b6f9cb25d217261e6e7c31bb59eef8fd123d11

 Hey @pbearne, while the current tests cover general validation for
 get_calendar(), they don’t seem to hit the exact scenario described in
 this ticket.

 The issue here is very specific: passing something like **?w=1400** or an
 invalid **$m** value triggers odd behavior such as computing a date
 ''9799'' days into the year or using DATE_ADD('00101', INTERVAL 9799 DAY)
 in the query.

 It might be worth adding a unit test that explicitly sets these out-of-
 range parameters to make sure the function handles them. That would both
 document the edge case and protect against regressions in the future.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/41011#comment:12>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list