From 8cbf331fa5e5861ccc268dddd335298b8461e8c7 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Fri, 14 Sep 2012 19:12:35 +0000 Subject: [PATCH] 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. git-svn-id: http://core.svn.wordpress.org/trunk@21849 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/options.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/wp-admin/options.php b/wp-admin/options.php index f72871e38f..faa9dec05e 100644 --- a/wp-admin/options.php +++ b/wp-admin/options.php @@ -139,14 +139,15 @@ if ( 'update' == $action ) { if ( $unregistered ) _deprecated_argument( 'options.php', '2.7', sprintf( __( 'The %1$s setting is unregistered. Unregistered settings are deprecated. See http://codex.wordpress.org/Settings_API' ), $option, $option_page ) ); - $option = trim($option); + $option = trim( $option ); $value = null; - if ( isset($_POST[$option]) ) - $value = $_POST[$option]; - if ( !is_array($value) ) - $value = trim($value); - $value = stripslashes_deep($value); - update_option($option, $value); + if ( isset( $_POST[ $option ] ) ) { + $value = $_POST[ $option ]; + if ( ! is_array( $value ) ) + $value = trim( $value ); + $value = stripslashes_deep( $value ); + } + update_option( $option, $value ); } }