mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 09:37:42 +01:00
Clone Objects in add_option()/update_option() to prevent storing PHP5 object references in memory cache. See [9740]. Fixes #13480
git-svn-id: http://svn.automattic.com/wordpress/trunk@14777 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
da25731eae
commit
bde0019142
@ -486,6 +486,9 @@ function update_option( $option, $newvalue ) {
|
||||
|
||||
wp_protect_special_option( $option );
|
||||
|
||||
if ( is_object($newvalue) )
|
||||
$newvalue = wp_clone($newvalue);
|
||||
|
||||
$newvalue = sanitize_option( $option, $newvalue );
|
||||
$oldvalue = get_option( $option );
|
||||
$newvalue = apply_filters( 'pre_update_option_' . $option, $newvalue, $oldvalue );
|
||||
@ -565,6 +568,10 @@ function add_option( $option, $value = '', $deprecated = '', $autoload = 'yes' )
|
||||
return false;
|
||||
|
||||
wp_protect_special_option( $option );
|
||||
|
||||
if ( is_object($value) )
|
||||
$value = wp_clone($value);
|
||||
|
||||
$value = sanitize_option( $option, $value );
|
||||
|
||||
// Make sure the option doesn't already exist. We can check the 'notoptions' cache before we ask for a db query
|
||||
|
Loading…
Reference in New Issue
Block a user