Opened 4 weeks ago
Last modified 4 weeks ago
#49566 reviewing enhancement
Change comment on `update_blog_option` to properly describe the return value
| Reported by: |  | Owned by: |  | 
|---|---|---|---|
| Milestone: | 5.5 | Priority: | normal | 
| Severity: | normal | Version: | trunk | 
| Component: | Options, Meta APIs | Keywords: | has-patch | 
| Focuses: | docs | Cc: | 
Description
update_blog_option uses update_option to set options, and that function doesn't only return false if there's an error: it can also return false if the value of the option hasn't changed. 
Reading the comment on update_blog_option, you're liable to assume false always means a failure, and make mistakes like: 
if ( false === update_blog_option( 9, 'import_id', 1 ) {
    return new WP_Error( 
        // error data
    );
} 
In this situation, every attempt to update an option that already has the value '1' will be treated as an error.
Attachments (2)
Change History (5)
Note: See
        TracTickets for help on using
        tickets.
    
 
                       
               
 
			 
                
The
update_optionfunction, which return value is used directly as output from theupdate_blog_optionfunction, uses following:@return bool False if value was not updated and true if value was updated.Perhaps we could make those the same, since the
update_blog_optionis kind of a wrapper around theupdate_option?If even that does not make it clear enough, we, IMHO, should update it in both places.