Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#61421 closed defect (bug) (fixed)

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

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

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.


2 years ago
#1

  • Keywords has-patch added; needs-patch removed

Trac ticket: #61421

krupal-panchal-md commented on PR #6795:


2 years 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:


2 years ago
#3

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

@krupalpanchal commented on PR #6795:


2 years ago
#4

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

#5 @jorbin
2 years ago

  • Milestone Awaiting Review6.6

#6 @jorbin
2 years ago

  • Keywords needs-dev-note added
  • Type enhancementdefect (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
2 years ago

  • Resolutionfixed
  • Status newclosed

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 2 years ago by sabernhardt (previous) (diff)

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


2 years ago

#10 @peterwilsoncc
2 years 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
2 years 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.