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
This commit is contained in:
nacin 2010-05-03 21:02:32 +00:00
parent 1afa45d117
commit 4d855dbda7
1 changed files with 5 additions and 2 deletions

View File

@ -3454,9 +3454,12 @@ function get_site_option( $option, $default = false, $use_cache = true ) {
$value = wp_cache_get($cache_key, 'site-options'); $value = wp_cache_get($cache_key, 'site-options');
if ( !isset($value) || (false === $value) ) { 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 = $default;
$value = maybe_unserialize( $value ); $value = maybe_unserialize( $value );