WordPress.org

Make WordPress Core

Changeset 13858


Ignore:
Timestamp:
03/28/2010 03:10:37 AM (12 years ago)
Author:
dd32
Message:

Do not allow empty option names. Trim leading and trailing whitespace from option names. Partial patch props ericmann. Fixes #11506

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions.php

    r13829 r13858  
    319319        return $pre;
    320320
     321    $option = trim($option);
     322    if ( empty($option) )
     323        return false;
     324
    321325    // prevent non-existent options from triggering multiple queries
    322326    if ( defined( 'WP_INSTALLING' ) && is_multisite() ) {
     
    489493    global $wpdb;
    490494
     495    $option = trim($option);
     496    if ( empty($option) )
     497        return false;
     498
    491499    wp_protect_special_option( $option );
    492500
     
    560568 */
    561569function add_option( $option, $value = '', $deprecated = '', $autoload = 'yes' ) {
     570    global $wpdb;
     571
    562572    if ( !empty( $deprecated ) )
    563573        _deprecated_argument( __FUNCTION__, '2.3' );
    564574
    565     global $wpdb;
     575    $option = trim($option);
     576    if ( empty($option) )
     577        return false;
    566578
    567579    wp_protect_special_option( $option );
Note: See TracChangeset for help on using the changeset viewer.