WordPress.org

Make WordPress Core

Opened 13 months ago

Last modified 3 months ago

#23881 new defect (bug)

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

Reported by: tenpura Owned by:
Milestone: Future Release 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 13 months ago.
23881.2.diff (679 bytes) - added by SergeyBiryukov 13 months ago.
23881.3.diff (1.6 KB) - added by ericmann 3 months ago.
Patch and matching unit test to verify Transient stability.

Download all attachments as: .zip

Change History (10)

tenpura13 months ago

comment:1 tenpura13 months ago

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

SergeyBiryukov13 months ago

comment:2 SergeyBiryukov13 months ago

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

Related: [10603], [10665]

comment:3 nacin13 months ago

  • Keywords needs-unit-tests added

comment:4 nacin12 months ago

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

Punting this until it has unit tests.

comment:5 nacin3 months ago

  • Component changed from General to Options and Meta

ericmann3 months ago

Patch and matching unit test to verify Transient stability.

comment:6 ericmann3 months ago

  • Keywords needs-unit-tests removed

Patched at WordCamp Phoenix

comment:7 ircbot3 months ago

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

Note: See TracTickets for help on using tickets.