Make WordPress Core

Opened 3 months ago

Closed 3 months ago

#64327 closed defect (bug) (duplicate)

WordPress transients are not cleared

Reported by: programmin's profile programmin Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Options, Meta APIs Keywords: 2nd-opinion
Focuses: Cc:

Description

I have some 5-minute transients that are never cleared due to the long name, and a varchar(191) option_name...

I am storing a wp transient with a long name, it is stored as option_name
_transient_timeout_{"json":"data"... (clipped 191 char)

and a option_value of timestamp of months ago, this is still picked up and is not cleared by WordPress system.

Change History (3)

#1 @peterwilsoncc
3 months ago

  • Component changed from General to Options, Meta APIs
  • Keywords 2nd-opinion added
  • Version 6.8.3 deleted

As noted in the documentation, there are limits to the length of transient names:

For your purposes, I'd recommend naming the transients with a hash of the JSON date.

I think the bug in this situation is that WordPress isn't catching the names are too long ans this is causing them not to be deleted. For long names WordPress could be updated to either:

  1. store the names as a hash
  2. throw a warning and not set the transient

My leaning is towards the second option as renaming the transient without notifying the developer would be confusing (the names would not appear in the database as expected) but I'll let others weigh in.

#2 @jorbin
3 months ago

I think this may be best considered a duplicate of #58903 which discusses some other issues (including using too long of a name) with transient names that violate the docs, but the code does not currently block.

#3 @westonruter
3 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

I've just milestoned #58903 for 7.0.

Note: See TracTickets for help on using tickets.