Ticket #4306: array_unset.diff

File array_unset.diff, 0.9 kB (added by ryan, 1 year ago)

Make sure notoptions is an array before unsetting

  • wp-includes/functions.php

    old new  
    322322        } 
    323323 
    324324        $notoptions = wp_cache_get('notoptions', 'options'); 
    325         if ( isset($notoptions[$option_name]) ) { 
     325        if ( is_array($notoptions) && isset($notoptions[$option_name]) ) { 
    326326                unset($notoptions[$option_name]); 
    327327                wp_cache_set('notoptions', $notoptions, 'options'); 
    328328        } 
     
    356356 
    357357        // Make sure the option doesn't already exist we can check the cache before we ask for a db query 
    358358        $notoptions = wp_cache_get('notoptions', 'options'); 
    359         if ( isset($notoptions[$name]) ) { 
     359        if ( is_array($notoptions) && isset($notoptions[$name]) ) { 
    360360                unset($notoptions[$name]); 
    361361                wp_cache_set('notoptions', $notoptions, 'options'); 
    362362        } elseif ( false !== get_option($name) ) {