Make WordPress Core

Opened 6 months ago

Closed 6 months ago

Last modified 6 months ago

#61421 closed defect (bug) (fixed)

Exipre comment author cookies after 1 year (rather than 0.95129375951 of a year)

Reported by: peterwilsoncc's profile peterwilsoncc Owned by:
Milestone: 6.6 Priority: low
Severity: normal Version:
Component: Comments Keywords: has-patch
Focuses: Cc:

Description

The comment author, comment email and comment URL cookies are currently set by wp_set_comment_cookies() to expire after 30000000 seconds.

I expect this value was chosen before the helper constants [time span]_IN_SECONDS existed. I also expect value was a rounding error on aiming for cookies to remain valid for one year.

To improve the readability of the code, it would nice to set the default lifetime of the cookies to YEAR_IN_SECONDS.

Change History (11)

This ticket was mentioned in PR #6795 on WordPress/wordpress-develop by @khokansardar.


6 months ago
#1

  • Keywords has-patch added; needs-patch removed

Trac ticket: #61421

krupal-panchal-md commented on PR #6795:


6 months ago
#2

The change looks good to me. It's better to use constant for the time span.

krupal-panchal-md commented on PR #6795:


6 months ago
#3

The change looks good to me. It's better to use constant for the time span.

@krupalpanchal commented on PR #6795:


6 months ago
#4

The change looks good to me. It's better to use constant for the time span.

#5 @jorbin
6 months ago

  • Milestone changed from Awaiting Review to 6.6

#6 @jorbin
6 months ago

  • Keywords needs-dev-note added
  • Type changed from enhancement to defect (bug)

Marking this as a bug since the intent was likely for this to be a year and it's just off by 154,0000. it should be included in the miscellaneous changes dev note since it's changes a default filter value.

#7 @sabernhardt
6 months ago

  • Resolution set to fixed
  • Status changed from new to closed

In [58401]:

Comments: Expire comment author cookies after 1 year (rather than 0.95129375951 of a year)
This filter was originally added in [19622] which predates the addition of the constant added in [21996] by 24085717 seconds.

Props peterwilsoncc, khokansardar, krupalpanchal.
Fixes #61412.


The comment_cookie_lifetime filter goes back further to [11223], or 106,907,253 seconds before [21996] :)

Last edited 6 months ago by sabernhardt (previous) (diff)

This ticket was mentioned in Slack in #core by juanmaguitar. View the logs.


6 months ago

#10 @peterwilsoncc
6 months ago

@jorbin, I don't think this needs a dev note. On the scale of things the change is a rounding error (17 days) and the intent hasn't changed, it just makes the code clearer.

#11 @jorbin
6 months ago

  • Keywords needs-dev-note removed

@peterwilsoncc I put it as a line in the misc changes dev note on the off chance that someone was using the filter to make a change based on the default value. I agree it's not worth a full dev note. Not a hill I am willing to die on for even one second, so if you think it serves no value there, go ahead and remove it.

As I already added it, I'm removing the "needs-dev-note" keyword.

Note: See TracTickets for help on using tickets.