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

WordPress Trac noreply at wordpress.org
Sat Aug 9 08:43:30 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-refresh  |     Focuses:
-------------------------------------+-----------------------
Changes (by rollybueno):

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


Comment:

 Merged latest trunk, run test and it's a failure:

 [[Image(https://i.imgur.com/pmd97hx.png)]]

 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:15>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list