Ticket #23881: 23881.3.diff
| File 23881.3.diff, 1.6 KB (added by , 12 years ago) |
|---|
-
src/wp-includes/option.php
451 451 $alloptions = wp_load_alloptions(); 452 452 if ( !isset( $alloptions[$transient_option] ) ) { 453 453 $transient_timeout = '_transient_timeout_' . $transient; 454 if ( get_option( $transient_timeout ) < time() ) { 454 $transient_timeout_value = get_option( $transient_timeout ); 455 if ( false !== $transient_timeout_value && $transient_timeout_value < time() ) { 455 456 delete_option( $transient_option ); 456 457 delete_option( $transient_timeout ); 457 458 $value = false; -
tests/phpunit/tests/option/transient.php
33 33 $this->assertEquals( $value, get_transient( $key ) ); 34 34 $this->assertTrue( delete_transient( $key ) ); 35 35 } 36 37 /** 38 * According to ticket 23881, requesting a transient beginning with "timeout_" and appending 39 * a valid transient key would inadvertently delete the timeout for the original transient. 40 * This test recreates that workflow (as to verify that the bug has been patched). 41 * 42 * @ticket 23881 43 */ 44 function test_timeout_safe_delete() { 45 $key = 'test'; 46 $value = '1234'; 47 48 $this->assertTrue( set_transient( $key, $value, 60 * 60 ) ); 49 get_transient( "timeout_{$key}" ); 50 51 // Verify our assertion 52 $this->assertEquals( $value, get_transient( $key ) ); 53 } 36 54 }