WordPress.org

Make WordPress Core

Ticket #18422: 18422.diff

File 18422.diff, 988 bytes (added by duck_, 4 years ago)

return false in add_option

  • wp-includes/functions.php

     
    586586 * @param mixed $value Optional. Option value, can be anything. Expected to not be SQL-escaped. 
    587587 * @param mixed $deprecated Optional. Description. Not used anymore. 
    588588 * @param bool $autoload Optional. Default is enabled. Whether to load the option when WordPress starts up. 
    589  * @return null returns when finished. 
     589 * @return bool False if option was not added and true if option was added. 
    590590 */ 
    591591function add_option( $option, $value = '', $deprecated = '', $autoload = 'yes' ) { 
    592592        global $wpdb; 
     
    609609        $notoptions = wp_cache_get( 'notoptions', 'options' ); 
    610610        if ( !is_array( $notoptions ) || !isset( $notoptions[$option] ) ) 
    611611                if ( false !== get_option( $option ) ) 
    612                         return; 
     612                        return false; 
    613613 
    614614        $_value = $value; 
    615615        $value = maybe_serialize( $value );