Make WordPress Core


Ignore:
Timestamp:
01/15/2016 07:34:16 PM (9 years ago)
Author:
boonebgorges
Message:

Populate term cache with proper clone of term objects.

[34999] modified the cache strategy for terms in the context of
wp_get_object_terms(). As part of these changes, the object_id property of
term objects had to be unset before being cached. To avoid modifying passed-by-
reference terms, update_term_cache() attempted to make a copy of the terms
passed to the function; however, it failed to use the clone keyword, and thus
only created a reference instead of a copy.

Props berengerzyla.
Fixes #35462.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/taxonomy.php

    r36252 r36323  
    37223722    foreach ( (array) $terms as $term ) {
    37233723        // Create a copy in case the array was passed by reference.
    3724         $_term = $term;
     3724        $_term = clone $term;
    37253725
    37263726        // Object ID should not be cached.
Note: See TracChangeset for help on using the changeset viewer.