Check if is_array before unsetting array index. fixes #4306

git-svn-id: http://svn.automattic.com/wordpress/branches/2.2@5500 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2007-05-21 16:38:53 +00:00
parent 1b8ddc740f
commit 6317b80f81
1 changed files with 2 additions and 2 deletions

View File

@ -322,7 +322,7 @@ function update_option($option_name, $newvalue) {
} }
$notoptions = wp_cache_get('notoptions', 'options'); $notoptions = wp_cache_get('notoptions', 'options');
if ( isset($notoptions[$option_name]) ) { if ( is_array($notoptions) && isset($notoptions[$option_name]) ) {
unset($notoptions[$option_name]); unset($notoptions[$option_name]);
wp_cache_set('notoptions', $notoptions, 'options'); wp_cache_set('notoptions', $notoptions, 'options');
} }
@ -356,7 +356,7 @@ function add_option($name, $value = '', $description = '', $autoload = 'yes') {
// Make sure the option doesn't already exist we can check the cache before we ask for a db query // Make sure the option doesn't already exist we can check the cache before we ask for a db query
$notoptions = wp_cache_get('notoptions', 'options'); $notoptions = wp_cache_get('notoptions', 'options');
if ( isset($notoptions[$name]) ) { if ( is_array($notoptions) && isset($notoptions[$name]) ) {
unset($notoptions[$name]); unset($notoptions[$name]);
wp_cache_set('notoptions', $notoptions, 'options'); wp_cache_set('notoptions', $notoptions, 'options');
} elseif ( false !== get_option($name) ) { } elseif ( false !== get_option($name) ) {