WordPress.org

Make WordPress Core

Ticket #16813: 16813.patch

File 16813.patch, 3.2 KB (added by hakre, 7 years ago)

Oh so fine.

  • wp-includes/cache.php

     
    350350                if ( isset ($this->cache[$group][$id]) ) {
    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];
    356356                }
     
    426426                        $data = '';
    427427
    428428                if ( is_object($data) )
    429                         $data = wp_clone($data);
     429                        $data = clone $data;
    430430
    431431                $this->cache[$group][$id] = $data;
    432432
  • wp-includes/comment.php

     
    13941394                        return false;
    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) ) ) {
    14001400                if ( $wp_error )
  • wp-includes/deprecated.php

     
    26022602        return true;
    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}
     2622 No newline at end of file
  • wp-includes/functions.php

     
    509509        wp_protect_special_option( $option );
    510510
    511511        if ( is_object($newvalue) )
    512                 $newvalue = wp_clone($newvalue);
     512                $newvalue = clone $newvalue;
    513513
    514514        $newvalue = sanitize_option( $option, $newvalue );
    515515        $oldvalue = get_option( $option );
     
    590590
    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 );
    597601
  • wp-includes/load.php

     
    552552}
    553553
    554554/**
    555  * Copy an object.
    556  *
    557  * Returns a cloned copy of an object.
    558  *
    559  * @since 2.7.0
    560  *
    561  * @param object $object The object to clone
    562  * @return object The cloned object
    563  */
    564 function wp_clone( $object ) {
    565         static $can_clone;
    566         if ( !isset( $can_clone ) )
    567                 $can_clone = version_compare( phpversion(), '5.0', '>=' );
    568 
    569         return $can_clone ? clone( $object ) : $object;
    570 }
    571 
    572 /**
    573555 * Whether the current request is for a network or blog admin page
    574556 *
    575557 * Does not inform on whether the user is an admin! Use capability checks to