mirror of
https://github.com/WordPress/WordPress.git
synced 2025-03-09 07:00:01 +00:00
Do not allow empty option names. Trim leading and trailing whitespace from option names. Partial patch props ericmann. Fixes #11506
git-svn-id: http://svn.automattic.com/wordpress/trunk@13858 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
47c064b890
commit
a0d734beea
@ -318,6 +318,10 @@ function get_option( $option, $default = false ) {
|
|||||||
if ( false !== $pre )
|
if ( false !== $pre )
|
||||||
return $pre;
|
return $pre;
|
||||||
|
|
||||||
|
$option = trim($option);
|
||||||
|
if ( empty($option) )
|
||||||
|
return false;
|
||||||
|
|
||||||
// prevent non-existent options from triggering multiple queries
|
// prevent non-existent options from triggering multiple queries
|
||||||
if ( defined( 'WP_INSTALLING' ) && is_multisite() ) {
|
if ( defined( 'WP_INSTALLING' ) && is_multisite() ) {
|
||||||
$notoptions = array();
|
$notoptions = array();
|
||||||
@ -488,6 +492,10 @@ function wp_load_core_site_options( $site_id = null ) {
|
|||||||
function update_option( $option, $newvalue ) {
|
function update_option( $option, $newvalue ) {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
|
$option = trim($option);
|
||||||
|
if ( empty($option) )
|
||||||
|
return false;
|
||||||
|
|
||||||
wp_protect_special_option( $option );
|
wp_protect_special_option( $option );
|
||||||
|
|
||||||
$newvalue = sanitize_option( $option, $newvalue );
|
$newvalue = sanitize_option( $option, $newvalue );
|
||||||
@ -559,10 +567,14 @@ function update_option( $option, $newvalue ) {
|
|||||||
* @return null returns when finished.
|
* @return null returns when finished.
|
||||||
*/
|
*/
|
||||||
function add_option( $option, $value = '', $deprecated = '', $autoload = 'yes' ) {
|
function add_option( $option, $value = '', $deprecated = '', $autoload = 'yes' ) {
|
||||||
|
global $wpdb;
|
||||||
|
|
||||||
if ( !empty( $deprecated ) )
|
if ( !empty( $deprecated ) )
|
||||||
_deprecated_argument( __FUNCTION__, '2.3' );
|
_deprecated_argument( __FUNCTION__, '2.3' );
|
||||||
|
|
||||||
global $wpdb;
|
$option = trim($option);
|
||||||
|
if ( empty($option) )
|
||||||
|
return false;
|
||||||
|
|
||||||
wp_protect_special_option( $option );
|
wp_protect_special_option( $option );
|
||||||
$value = sanitize_option( $option, $value );
|
$value = sanitize_option( $option, $value );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user