diff --git a/wp-includes/cache.php b/wp-includes/cache.php index 67c7b241a..f73f02bf6 100644 --- a/wp-includes/cache.php +++ b/wp-includes/cache.php @@ -350,7 +350,7 @@ class WP_Object_Cache { if ( isset ($this->cache[$group][$id]) ) { $this->cache_hits += 1; if ( is_object($this->cache[$group][$id]) ) - return wp_clone($this->cache[$group][$id]); + return clone $this->cache[$group][$id]; else return $this->cache[$group][$id]; } @@ -426,7 +426,7 @@ class WP_Object_Cache { $data = ''; if ( is_object($data) ) - $data = wp_clone($data); + $data = clone $data; $this->cache[$group][$id] = $data; diff --git a/wp-includes/comment.php b/wp-includes/comment.php index c0c175661..08919f315 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -1394,7 +1394,7 @@ function wp_set_comment_status($comment_id, $comment_status, $wp_error = false) return false; } - $comment_old = wp_clone(get_comment($comment_id)); + $comment_old = clone get_comment($comment_id); if ( !$wpdb->update( $wpdb->comments, array('comment_approved' => $status), array('comment_ID' => $comment_id) ) ) { if ( $wp_error ) diff --git a/wp-includes/deprecated.php b/wp-includes/deprecated.php index 579f59fe3..bc2f7a0a1 100644 --- a/wp-includes/deprecated.php +++ b/wp-includes/deprecated.php @@ -2602,3 +2602,20 @@ function update_category_cache() { return true; } + +/** + * Copy an object. + * + * Returns a cloned copy of an object. + * + * @since 2.7.0 + * @deprecated 3.2 + * + * @param object $object The object to clone + * @return object The cloned object + */ +function wp_clone( $object ) { + _deprecated_function( __FUNCTION__, '3.2' ); + + return clone $object; +} \ No newline at end of file diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 39fc45cf5..7abe4525b 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -509,7 +509,7 @@ function update_option( $option, $newvalue ) { wp_protect_special_option( $option ); if ( is_object($newvalue) ) - $newvalue = wp_clone($newvalue); + $newvalue = clone $newvalue; $newvalue = sanitize_option( $option, $newvalue ); $oldvalue = get_option( $option ); @@ -590,8 +590,12 @@ function add_option( $option, $value = '', $deprecated = '', $autoload = 'yes' ) wp_protect_special_option( $option ); + /* + * FIXME the next two lines of code are not necessary and should be removed. + * @see http://core.trac.wordpress.org/ticket/13480 + */ if ( is_object($value) ) - $value = wp_clone($value); + $value = clone $value; $value = sanitize_option( $option, $value ); diff --git a/wp-includes/load.php b/wp-includes/load.php index e60f90da6..1a4654165 100644 --- a/wp-includes/load.php +++ b/wp-includes/load.php @@ -553,24 +553,6 @@ function shutdown_action_hook() { wp_cache_close(); } -/** - * Copy an object. - * - * Returns a cloned copy of an object. - * - * @since 2.7.0 - * - * @param object $object The object to clone - * @return object The cloned object - */ -function wp_clone( $object ) { - static $can_clone; - if ( !isset( $can_clone ) ) - $can_clone = version_compare( phpversion(), '5.0', '>=' ); - - return $can_clone ? clone( $object ) : $object; -} - /** * Whether the current request is for a network or blog admin page *