From b3b0c727fc2b12f721fd9007cbf91af04ca4ff35 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Mon, 3 May 2010 21:02:32 +0000 Subject: [PATCH] Use get_row instead of get_var in get_site_option, aligning it with get_option, due to funkiness with 0/false/null. fixes #13043. props laceous. git-svn-id: https://develop.svn.wordpress.org/trunk@14410 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/functions.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 01702c4b53..4cc95a7fae 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -3454,9 +3454,12 @@ function get_site_option( $option, $default = false, $use_cache = true ) { $value = wp_cache_get($cache_key, 'site-options'); if ( !isset($value) || (false === $value) ) { - $value = $wpdb->get_var( $wpdb->prepare("SELECT meta_value FROM $wpdb->sitemeta WHERE meta_key = %s AND site_id = %d", $option, $wpdb->siteid ) ); + $row = $wpdb->get_row( $wpdb->prepare("SELECT meta_value FROM $wpdb->sitemeta WHERE meta_key = %s AND site_id = %d", $option, $wpdb->siteid ) ); - if ( is_null($value) ) + // Has to be get_row instead of get_var because of funkiness with 0, false, null values + if ( is_object( $row ) ) + $value = $row->meta_value; + else $value = $default; $value = maybe_unserialize( $value );