[wp-trac] [WordPress Trac] #15497: update_site_option can fail for values that cast to false

WordPress Trac wp-trac at lists.automattic.com
Fri Nov 19 17:33:59 UTC 2010


#15497: update_site_option can fail for values that cast to false
--------------------------+-------------------------------------------------
 Reporter:  duck_         |       Owner:                 
     Type:  defect (bug)  |      Status:  new            
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:  3.0            
 Severity:  normal        |    Keywords:  has-patch      
--------------------------+-------------------------------------------------
 Passing a value to update_site_option that casts to false (e.g. 0) doesn't
 work when the site option doesn't already exist because of:

 {{{
 if ( $value && !$wpdb->get_row( $wpdb->prepare( "SELECT meta_value FROM
 $wpdb->sitemeta WHERE meta_key = %s AND site_id = %d", $option,
 $wpdb->siteid ) ) )
     return add_site_option( $option, $value );
 }}}

 `update_option` has no such restriction (the first part of the
 conditional).

 Found when investigating #15496 as the compression test might call
 `update_site_option('can_compress_scripts', 0);`, so in some circumstances
 the compression test is loaded on every admin screen.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/15497>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list