Opened 14 years ago
Closed 14 years ago
#13043 closed defect (bug) (fixed)
get_site_option should use wpdb->get_row
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | 3.0 | Priority: | normal |
Severity: | normal | Version: | 3.0 |
Component: | Multisite | Keywords: | has-patch |
Focuses: | Cc: |
Description
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)
Attachments (1)
Change History (5)
Note: See
TracTickets for help on using
tickets.
change get_var to get_row