From 4d855dbda7fabb00971544f0d6cc46d4da626ab9 Mon Sep 17 00:00:00 2001 From: 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: http://svn.automattic.com/wordpress/trunk@14410 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- 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 );