Ticket #32848: 32848.2.diff
File 32848.2.diff, 5.1 KB (added by , 9 years ago) |
---|
-
src/wp-includes/option.php
54 54 if ( ! defined( 'WP_INSTALLING' ) ) { 55 55 // prevent non-existent options from triggering multiple queries 56 56 $notoptions = wp_cache_get( 'notoptions', 'options' ); 57 if ( isset( $notoptions[ $option ]) ) {57 if ( array_key_exists( $option, $notoptions ) ) { 58 58 /** 59 59 * Filter the default value for an option. 60 60 * … … 70 70 71 71 $alloptions = wp_load_alloptions(); 72 72 73 if ( isset( $alloptions[$option]) ) {73 if ( array_key_exists( $option, $alloptions ) ) { 74 74 $value = $alloptions[$option]; 75 75 } else { 76 76 $value = wp_cache_get( $option, 'options' ); … … 319 319 return false; 320 320 321 321 $notoptions = wp_cache_get( 'notoptions', 'options' ); 322 if ( is_array( $notoptions ) && isset( $notoptions[$option]) ) {322 if ( is_array( $notoptions ) && array_key_exists( $option, $notoptions ) ) { 323 323 unset( $notoptions[$option] ); 324 324 wp_cache_set( 'notoptions', $notoptions, 'options' ); 325 325 } 326 326 327 327 if ( ! defined( 'WP_INSTALLING' ) ) { 328 328 $alloptions = wp_load_alloptions(); 329 if ( isset( $alloptions[$option]) ) {329 if ( array_key_exists( $option, $alloptions ) ) { 330 330 $alloptions[ $option ] = $serialized_value; 331 331 wp_cache_set( 'alloptions', $alloptions, 'options' ); 332 332 } else { … … 401 401 402 402 // Make sure the option doesn't already exist. We can check the 'notoptions' cache before we ask for a db query 403 403 $notoptions = wp_cache_get( 'notoptions', 'options' ); 404 if ( !is_array( $notoptions ) || ! isset( $notoptions[$option]) )404 if ( !is_array( $notoptions ) || !array_key_exists( $option, $notoptions ) ) 405 405 /** This filter is documented in wp-includes/option.php */ 406 406 if ( apply_filters( 'default_option_' . $option, false ) !== get_option( $option ) ) 407 407 return false; … … 435 435 436 436 // This option exists now 437 437 $notoptions = wp_cache_get( 'notoptions', 'options' ); // yes, again... we need it to be fresh 438 if ( is_array( $notoptions ) && isset( $notoptions[$option]) ) {438 if ( is_array( $notoptions ) && array_key_exists( $option, $notoptions ) ) { 439 439 unset( $notoptions[$option] ); 440 440 wp_cache_set( 'notoptions', $notoptions, 'options' ); 441 441 } … … 502 502 if ( ! defined( 'WP_INSTALLING' ) ) { 503 503 if ( 'yes' == $row->autoload ) { 504 504 $alloptions = wp_load_alloptions(); 505 if ( is_array( $alloptions ) && isset( $alloptions[$option]) ) {505 if ( is_array( $alloptions ) && array_key_exists( $option, $alloptions ) ) { 506 506 unset( $alloptions[$option] ); 507 507 wp_cache_set( 'alloptions', $alloptions, 'options' ); 508 508 } … … 620 620 if ( ! defined( 'WP_INSTALLING' ) ) { 621 621 // If option is not in alloptions, it is not autoloaded and thus has a timeout 622 622 $alloptions = wp_load_alloptions(); 623 if ( ! isset( $alloptions[$transient_option]) ) {623 if ( !array_key_exists( $transient_option, $alloptions ) ) { 624 624 $transient_timeout = '_transient_timeout_' . $transient; 625 625 if ( get_option( $transient_timeout ) < time() ) { 626 626 delete_option( $transient_option ); … … 800 800 function get_user_setting( $name, $default = false ) { 801 801 $all_user_settings = get_all_user_settings(); 802 802 803 return isset( $all_user_settings[$name]) ? $all_user_settings[$name] : $default;803 return array_key_exists( $name, $all_user_settings ) ) ? $all_user_settings[$name] : $default; 804 804 } 805 805 806 806 /** … … 847 847 $deleted = false; 848 848 849 849 foreach ( $names as $name ) { 850 if ( isset( $all_user_settings[$name]) ) {850 if ( array_key_exists( $name, $all_user_settings ) ) { 851 851 unset( $all_user_settings[$name] ); 852 852 $deleted = true; 853 853 } … … 993 993 $notoptions_key = "{$wpdb->siteid}:notoptions"; 994 994 $notoptions = wp_cache_get( $notoptions_key, 'site-options' ); 995 995 996 if ( isset( $notoptions[$option]) ) {996 if ( array_key_exists( $option, $notoptions ) ) { 997 997 998 998 /** 999 999 * Filter a specific default site option. … … 1093 1093 1094 1094 // Make sure the option doesn't already exist. We can check the 'notoptions' cache before we ask for a db query 1095 1095 $notoptions = wp_cache_get( $notoptions_key, 'site-options' ); 1096 if ( ! is_array( $notoptions ) || ! isset( $notoptions[$option]) )1096 if ( ! is_array( $notoptions ) || ! array_key_exists( $option, $notoptions ) ) 1097 1097 if ( false !== get_site_option( $option ) ) 1098 1098 return false; 1099 1099 … … 1109 1109 1110 1110 // This option exists now 1111 1111 $notoptions = wp_cache_get( $notoptions_key, 'site-options' ); // yes, again... we need it to be fresh 1112 if ( is_array( $notoptions ) && isset( $notoptions[$option]) ) {1112 if ( is_array( $notoptions ) && array_key_exists( $option, $notoptions ) ) { 1113 1113 unset( $notoptions[$option] ); 1114 1114 wp_cache_set( $notoptions_key, $notoptions, 'site-options' ); 1115 1115 } … … 1252 1252 1253 1253 $notoptions_key = "{$wpdb->siteid}:notoptions"; 1254 1254 $notoptions = wp_cache_get( $notoptions_key, 'site-options' ); 1255 if ( is_array( $notoptions ) && isset( $notoptions[$option]) ) {1255 if ( is_array( $notoptions ) && array_key_exists( $option, $notoptions ) ) { 1256 1256 unset( $notoptions[$option] ); 1257 1257 wp_cache_set( $notoptions_key, $notoptions, 'site-options' ); 1258 1258 }