WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 3 years ago

#23881 closed defect (bug) (duplicate)

get_transient() could delete transient timeout options in an unexpected way

Reported by: tenpura Owned by:
Milestone: Priority: normal
Severity: minor Version: 2.8
Component: Options, Meta APIs Keywords: has-patch
Focuses: Cc:

Description

get_transient() could delete transient timeout options if a given transient name has the "timeout_" prefix.

To reproduce:

set_transient( 'test', 'test', 60*60 );
get_transient( 'timeout_test' ); // will delete the _transient_timeout_test option

Solution:

Check if get_option( $transient_timeout ) is not returning false.

if ( false !== get_option( $transient_timeout ) && get_option( $transient_timeout ) < time() ) {

Attachments (3)

23881.diff (624 bytes) - added by tenpura 5 years ago.
23881.2.diff (679 bytes) - added by SergeyBiryukov 5 years ago.
23881.3.diff (1.6 KB) - added by ericmann 4 years ago.
Patch and matching unit test to verify Transient stability.

Download all attachments as: .zip

Change History (11)

@tenpura
5 years ago

#1 @tenpura
5 years ago

  • Summary changed from get_transient() could delete transient timeout options to get_transient() could delete transient timeout options in an unexpected way

#2 @SergeyBiryukov
5 years ago

  • Milestone changed from Awaiting Review to 3.6
  • Version changed from trunk to 2.8

Related: [10603], [10665]

#3 @nacin
5 years ago

  • Keywords needs-unit-tests added

#4 @nacin
5 years ago

  • Milestone changed from 3.6 to Future Release
  • Severity changed from normal to minor

Punting this until it has unit tests.

#5 @nacin
4 years ago

  • Component changed from General to Options and Meta

@ericmann
4 years ago

Patch and matching unit test to verify Transient stability.

#6 @ericmann
4 years ago

  • Keywords needs-unit-tests removed

Patched at WordCamp Phoenix

This ticket was mentioned in IRC in #wordpress-dev by ericmann. View the logs.


4 years ago

#8 @ocean90
3 years ago

  • Milestone Future Release deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #30380.

Note: See TracTickets for help on using tickets.