Ticket #15058: 15058.1.diff
File 15058.1.diff, 2.2 KB (added by , 10 years ago) |
---|
-
src/wp-includes/option.php
240 240 if ( is_object( $value ) ) 241 241 $value = clone $value; 242 242 243 if( strlen( $option ) > 64 ) { 244 $option = md5( $option ); 245 $option = "md5_" . $option; 246 } 247 243 248 $value = sanitize_option( $option, $value ); 244 249 $old_value = get_option( $option ); 245 250 … … 377 382 $serialized_value = maybe_serialize( $value ); 378 383 $autoload = ( 'no' === $autoload ) ? 'no' : 'yes'; 379 384 385 if( strlen( $option ) > 64 ) { 386 $option = md5( $option ); 387 $option = "md5_" . $option; 388 } 389 380 390 /** 381 391 * Fires before an option is added. 382 392 * … … 582 592 if ( wp_using_ext_object_cache() ) { 583 593 $value = wp_cache_get( $transient, 'transient' ); 584 594 } else { 595 596 if( strlen( $transient ) > 40 ) { 597 $transient = md5( $transient ); 598 $transient = "md5_" . $transient; 599 } 600 585 601 $transient_option = '_transient_' . $transient; 586 602 if ( ! defined( 'WP_INSTALLING' ) ) { 587 603 // If option is not in alloptions, it is not autoloaded and thus has a timeout … … 645 661 if ( wp_using_ext_object_cache() ) { 646 662 $result = wp_cache_set( $transient, $value, 'transient', $expiration ); 647 663 } else { 664 665 if( strlen( $transient ) > 40 ) { 666 $transient = md5( $transient ); 667 $transient = "md5_" . $transient; 668 } 669 648 670 $transient_timeout = '_transient_timeout_' . $transient; 649 671 $transient = '_transient_' . $transient; 672 650 673 if ( false === get_option( $transient ) ) { 651 674 $autoload = 'yes'; 652 675 if ( $expiration ) { -
tests/phpunit/tests/option/transient.php
83 83 update_option( '_transient_timeout_' . $key, $now - 1 ); 84 84 $this->assertFalse( get_transient( $key ) ); 85 85 } 86 87 /** 88 * ticket 15058 89 */ 90 function test_transient_long() { 91 $long_name = "thisisaverylongnamethatwillnotfitincolumnbecauseitistoolongforthecolumn"; 92 set_transient( $long_name, true, 60 ); 93 $this->assertTrue( get_transient( $long_name ) ); 94 } 86 95 }