Make WordPress Core

Opened 14 years ago

Closed 11 years ago

#23881 closed defect (bug) (duplicate)

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

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

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 14 years ago.
23881.2.diff​ (679 bytes ) - added by SergeyBiryukov 14 years ago.
23881.3.diff​ (1.6 KB ) - added by ericmann 13 years ago.
Patch and matching unit test to verify Transient stability.

Download all attachments as: .zip

Change History (11)

@tenpura
14 years ago

#1 @tenpura
14 years ago

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

#2 @SergeyBiryukov
14 years ago

  • Milestone Awaiting Review → 3.6
  • Version trunk → 2.8

Related: [10603], [10665]

#3 @nacin
14 years ago

  • Keywords needs-unit-tests added

#4 @nacin
13 years ago

  • Milestone 3.6 → Future Release
  • Severity normal → minor

Punting this until it has unit tests.

#5 @nacin
13 years ago

  • Component General → Options and Meta

@ericmann
13 years ago

Patch and matching unit test to verify Transient stability.

#6 @ericmann
13 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.


13 years ago

#8 @ocean90
11 years ago

  • Milestone Future Release
  • Resolution → duplicate
  • Status new → closed

Duplicate of #30380.

Note: See TracTickets for help on using tickets.