add_option() should always return a boolean, see #18422

git-svn-id: http://svn.automattic.com/wordpress/trunk@18567 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
duck_ 2011-08-18 18:17:37 +00:00
parent 0995987f25
commit 48974fa6e2
1 changed files with 2 additions and 2 deletions

View File

@ -586,7 +586,7 @@ function update_option( $option, $newvalue ) {
* @param mixed $value Optional. Option value, can be anything. Expected to not be SQL-escaped.
* @param mixed $deprecated Optional. Description. Not used anymore.
* @param bool $autoload Optional. Default is enabled. Whether to load the option when WordPress starts up.
* @return null returns when finished.
* @return bool False if option was not added and true if option was added.
*/
function add_option( $option, $value = '', $deprecated = '', $autoload = 'yes' ) {
global $wpdb;
@ -609,7 +609,7 @@ function add_option( $option, $value = '', $deprecated = '', $autoload = 'yes' )
$notoptions = wp_cache_get( 'notoptions', 'options' );
if ( !is_array( $notoptions ) || !isset( $notoptions[$option] ) )
if ( false !== get_option( $option ) )
return;
return false;
$_value = $value;
$value = maybe_serialize( $value );