From 11ab449a89e54a5cdb8a62bad15fa02063dc0fd7 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Thu, 28 Feb 2013 16:49:20 +0000 Subject: [PATCH] Ensure we strictly compare 'alloptions' and 'notoptions' when protecting these special options. Trim and check for emptiness of $option in delete_option(), as done for get, update, and add. fixes #23289. git-svn-id: https://develop.svn.wordpress.org/trunk@23510 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/option.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/wp-includes/option.php b/wp-includes/option.php index 722d1f30d4..509ec44d6a 100644 --- a/wp-includes/option.php +++ b/wp-includes/option.php @@ -104,8 +104,7 @@ function get_option( $option, $default = false ) { * @param string $option Option name. */ function wp_protect_special_option( $option ) { - $protected = array( 'alloptions', 'notoptions' ); - if ( in_array( $option, $protected ) ) + if ( 'alloptions' === $option || 'notoptions' === $option ) wp_die( sprintf( __( '%s is a protected WP option and may not be modified' ), esc_html( $option ) ) ); } @@ -360,6 +359,10 @@ function add_option( $option, $value = '', $deprecated = '', $autoload = 'yes' ) function delete_option( $option ) { global $wpdb; + $option = trim( $option ); + if ( empty( $option ) ) + return false; + wp_protect_special_option( $option ); // Get the ID, if no ID then return