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. Built from https://develop.svn.wordpress.org/trunk@36323 git-svn-id: http://core.svn.wordpress.org/trunk@36290 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
e85f75f23f
commit
d5bc0fe493
|
@ -3721,7 +3721,7 @@ function update_object_term_cache($object_ids, $object_type) {
|
||||||
function update_term_cache( $terms, $taxonomy = '' ) {
|
function update_term_cache( $terms, $taxonomy = '' ) {
|
||||||
foreach ( (array) $terms as $term ) {
|
foreach ( (array) $terms as $term ) {
|
||||||
// Create a copy in case the array was passed by reference.
|
// Create a copy in case the array was passed by reference.
|
||||||
$_term = $term;
|
$_term = clone $term;
|
||||||
|
|
||||||
// Object ID should not be cached.
|
// Object ID should not be cached.
|
||||||
unset( $_term->object_id );
|
unset( $_term->object_id );
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.5-alpha-1452886392909';
|
$wp_version = '4.5-alpha-1452886512627';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue