[wp-trac] [WordPress Trac] #13043: get_site_option should use wpdb->get_row
WordPress Trac
wp-trac at lists.automattic.com
Sun Apr 18 18:27:00 UTC 2010
#13043: get_site_option should use wpdb->get_row
--------------------------+-------------------------------------------------
Reporter: laceous | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 3.0
Component: General | Version: 3.0
Severity: normal | Keywords:
--------------------------+-------------------------------------------------
get_option uses the following code when pulling data from the database:
{{{
$row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM
$wpdb->options WHERE option_name = '%s' LIMIT 1", $option ) );
// Has to be get_row instead of get_var because of funkiness with 0,
false, null values
if ( is_object( $row ) ) {
}}}
get_site_option uses get_var directly which leads to the funkiness that
get_option tries to avoid:
{{{
$value = $wpdb->get_var( $wpdb->prepare("SELECT meta_value FROM
$wpdb->sitemeta WHERE meta_key = %s AND site_id = %d", $option,
$wpdb->siteid ) );
if ( is_null($value) )
$value = $default;
}}}
get_site_option should use get_row instead of get_var
(This was tested with the latest nightly build)
--
Ticket URL: <http://core.trac.wordpress.org/ticket/13043>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list