Ticket #10788: 10788-transient-filters-safe-fix.patch
| File 10788-transient-filters-safe-fix.patch, 2.0 KB (added by nacin, 3 years ago) |
|---|
-
functions.php
658 658 global $_wp_using_ext_object_cache, $wpdb; 659 659 660 660 if ( $_wp_using_ext_object_cache ) { 661 returnwp_cache_delete($transient, 'transient');661 $value = wp_cache_delete($transient, 'transient'); 662 662 } else { 663 663 $transient = '_transient_' . esc_sql($transient); 664 returndelete_option($transient);664 $value = delete_option($transient); 665 665 } 666 667 return apply_filters('delete_transient_' . $transient, $value); 666 668 } 667 669 668 670 /** … … 688 690 if ( $_wp_using_ext_object_cache ) { 689 691 $value = wp_cache_get($transient, 'transient'); 690 692 } else { 691 $transient_option = '_transient_' . esc_sql($transient);693 $transient_option = '_transient_' . $transient; 692 694 // If option is not in alloptions, it is not autoloaded and thus has a timeout 693 695 $alloptions = wp_load_alloptions(); 694 696 if ( !isset( $alloptions[$transient_option] ) ) { 695 $transient_timeout = '_transient_timeout_' . esc_sql($transient);696 if ( get_option( $transient_timeout) < time() ) {697 $transient_timeout = '_transient_timeout_' . $transient; 698 if ( get_option( esc_sql($transient_timeout) ) < time() ) { 697 699 delete_option($transient_option); 698 700 delete_option($transient_timeout); 699 701 return false; 700 702 } 701 703 } 702 704 703 $value = get_option( $transient_option);705 $value = get_option( esc_sql($transient_option) ); 704 706 } 705 707 706 708 return apply_filters('transient_' . $transient, $value); … … 736 738 $autoload = 'no'; 737 739 add_option($transient_timeout, time() + $expiration, '', 'no'); 738 740 } 739 returnadd_option($transient, $value, '', $autoload);741 $value = add_option($transient, $value, '', $autoload); 740 742 } else { 741 743 if ( 0 != $expiration ) 742 744 update_option($transient_timeout, time() + $expiration); 743 returnupdate_option($transient, $value);745 $value = update_option($transient, $value); 744 746 } 745 747 } 748 749 return apply_filters('set_transient_' . $transient, $value); 746 750 } 747 751 748 752 /**
