[wp-trac] [WordPress Trac] #65046: get_weekstartend() has swapped variable names and comments for month and day
WordPress Trac
noreply at wordpress.org
Tue May 26 15:10:03 UTC 2026
#65046: get_weekstartend() has swapped variable names and comments for month and
day
-------------------------------------+-------------------------------------
Reporter: saratheonline | Owner: westonruter
Type: defect (bug) | Status: closed
Priority: normal | Milestone: 7.1
Component: Date/Time | Version: 7.0
Severity: normal | Resolution: fixed
Keywords: has-patch needs-testing | Focuses: sustainability,
commit | coding-standards
-------------------------------------+-------------------------------------
Changes (by SergeyBiryukov):
* status: reviewing => closed
* resolution: => fixed
Comment:
In [changeset:"62421" 62421]:
{{{
#!CommitTicketReference repository="" revision="62421"
Docs: Correct swapped variable names and comments in `get_weekstartend()`.
The variables `$mm` and `$md` had their `substr()` positions and inline
comments swapped — `$mm` was extracting the day digits (position 8) while
`$md` was extracting the month digits (position 5), contrary to what the
comments indicated.
The output was accidentally correct because the two mistakes cancelled
each other out in the `mktime()` call, but the misleading naming posed a
future maintenance risk.
This commit corrects the `substr()` positions and `mktime()` argument
order so that variable names, comments, and logic are all consistent.
Follow-up to [8598], [28918].
Props saratheonline, westonruter.
Fixes #65046.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/65046#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list