[wp-trac] [WordPress Trac] #41011: get_calendar generates query with invalid date formats
WordPress Trac
noreply at wordpress.org
Thu Jul 31 11:09:43 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 has-unit-tests | Focuses:
--------------------------------------+-----------------------
Comment (by rollybueno):
Alright, I'll try to stress test this tomorrow.
Replying to [comment:13 pbearne]:
> Replying to [comment:12 rollybueno]:
> > 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.
>
> I think this is covered in the test_get_calendar_out_of_range test
> I didn't use 1400, but rather just 60
--
Ticket URL: <https://core.trac.wordpress.org/ticket/41011#comment:14>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list