WordPress.org

Make WordPress Core

Changeset 21849


Ignore:
Timestamp:
09/14/2012 07:12:35 PM (8 years ago)
Author:
nacin
Message:

If an option was not sent to options.php, pass null to update_option(), rather than trimming the null and converting it to an empty string. This provides better context for sanitize_option() while still storing what ends up being an empty string either way. see #16416.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/options.php

    r21842 r21849  
    140140                _deprecated_argument( 'options.php', '2.7', sprintf( __( 'The <code>%1$s</code> setting is unregistered. Unregistered settings are deprecated. See http://codex.wordpress.org/Settings_API' ), $option, $option_page ) );
    141141
    142             $option = trim($option);
     142            $option = trim( $option );
    143143            $value = null;
    144             if ( isset($_POST[$option]) )
    145                 $value = $_POST[$option];
    146             if ( !is_array($value) )
    147                 $value = trim($value);
    148             $value = stripslashes_deep($value);
    149             update_option($option, $value);
     144            if ( isset( $_POST[ $option ] ) ) {
     145                $value = $_POST[ $option ];
     146                if ( ! is_array( $value ) )
     147                    $value = trim( $value );
     148                $value = stripslashes_deep( $value );
     149            }
     150            update_option( $option, $value );
    150151        }
    151152    }
Note: See TracChangeset for help on using the changeset viewer.