WordPress.org

Make WordPress Core

Changeset 17613


Ignore:
Timestamp:
04/06/2011 05:44:29 PM (11 years ago)
Author:
ryan
Message:

Deprecate wp_clone(). Call clone directly. Props hakre. fixes #16813

Location:
trunk/wp-includes
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/cache.php

    r17604 r17613  
    351351            $this->cache_hits += 1;
    352352            if ( is_object($this->cache[$group][$id]) )
    353                 return wp_clone($this->cache[$group][$id]);
     353                return clone $this->cache[$group][$id];
    354354            else
    355355                return $this->cache[$group][$id];
     
    427427
    428428        if ( is_object($data) )
    429             $data = wp_clone($data);
     429            $data = clone $data;
    430430
    431431        $this->cache[$group][$id] = $data;
  • trunk/wp-includes/comment.php

    r17053 r17613  
    13951395    }
    13961396
    1397     $comment_old = wp_clone(get_comment($comment_id));
     1397    $comment_old = clone get_comment($comment_id);
    13981398
    13991399    if ( !$wpdb->update( $wpdb->comments, array('comment_approved' => $status), array('comment_ID' => $comment_id) ) ) {
  • trunk/wp-includes/deprecated.php

    r17541 r17613  
    26032603}
    26042604
     2605
     2606/**
     2607 * Copy an object.
     2608 *
     2609 * Returns a cloned copy of an object.
     2610 *
     2611 * @since 2.7.0
     2612 * @deprecated 3.2
     2613 *
     2614 * @param object $object The object to clone
     2615 * @return object The cloned object
     2616 */
     2617function wp_clone( $object ) {
     2618    _deprecated_function( __FUNCTION__, '3.2' );
     2619
     2620    return clone $object;
     2621}
  • trunk/wp-includes/functions.php

    r17603 r17613  
    510510
    511511    if ( is_object($newvalue) )
    512         $newvalue = wp_clone($newvalue);
     512        $newvalue = clone $newvalue;
    513513
    514514    $newvalue = sanitize_option( $option, $newvalue );
     
    591591    wp_protect_special_option( $option );
    592592
     593    /*
     594     * FIXME the next two lines of code are not necessary and should be removed.
     595     * @see http://core.trac.wordpress.org/ticket/13480
     596     */
    593597    if ( is_object($value) )
    594         $value = wp_clone($value);
     598        $value = clone $value;
    595599
    596600    $value = sanitize_option( $option, $value );
  • trunk/wp-includes/load.php

    r17575 r17613  
    555555
    556556/**
    557  * Copy an object.
    558  *
    559  * Returns a cloned copy of an object.
    560  *
    561  * @since 2.7.0
    562  *
    563  * @param object $object The object to clone
    564  * @return object The cloned object
    565  */
    566 function wp_clone( $object ) {
    567     static $can_clone;
    568     if ( !isset( $can_clone ) )
    569         $can_clone = version_compare( phpversion(), '5.0', '>=' );
    570 
    571     return $can_clone ? clone( $object ) : $object;
    572 }
    573 
    574 /**
    575557 * Whether the current request is for a network or blog admin page
    576558 *
Note: See TracChangeset for help on using the changeset viewer.