Taxonomy: 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.

Merges [36323] to the 4.4 branch.
Props berengerzyla.
Fixes #35462.

Built from https://develop.svn.wordpress.org/branches/4.4@36358


git-svn-id: http://core.svn.wordpress.org/branches/4.4@36325 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dion Hulse 2016-01-20 05:35:27 +00:00
parent d1c894df29
commit 3131897233
1 changed files with 1 additions and 1 deletions

View File

@ -3646,7 +3646,7 @@ function update_object_term_cache($object_ids, $object_type) {
function update_term_cache( $terms, $taxonomy = '' ) {
foreach ( (array) $terms as $term ) {
// Create a copy in case the array was passed by reference.
$_term = $term;
$_term = clone $term;
// Object ID should not be cached.
unset( $_term->object_id );