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
This commit is contained in:
Andrew Nacin 2012-09-14 19:12:35 +00:00
parent 7d7498f7ab
commit 8cbf331fa5
1 changed files with 8 additions and 7 deletions

View File

@ -141,11 +141,12 @@ if ( 'update' == $action ) {
$option = trim( $option );
$value = null;
if ( isset($_POST[$option]) )
if ( isset( $_POST[ $option ] ) ) {
$value = $_POST[ $option ];
if ( ! is_array( $value ) )
$value = trim( $value );
$value = stripslashes_deep( $value );
}
update_option( $option, $value );
}
}