Make WordPress Core

Opened 4 weeks ago

Last modified 4 weeks ago

#63618 new defect (bug)

`is_object_in_term` object cache uses "set" instead of "add"

Reported by: nlemoine's profile nlemoine Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: trunk
Component: Cache API Keywords: has-patch
Focuses: Cc:

Description

is_object_in_term should respect [wp_suspend_cache_addition](https://developer.wordpress.org/reference/functions/wp_suspend_cache_addition/) and use wp_cache_add instead of wp_cache_set as in [get_the_terms](https://github.com/WordPress/WordPress/blob/c6041fd40a9d499a5d602be791349068699ef695/wp-includes/category-template.php#L1297-L1303)

Blamed line: https://github.com/WordPress/WordPress/blob/c6041fd40a9d499a5d602be791349068699ef695/wp-includes/taxonomy.php#L4895

I stumbled upon this building a long running WP-CLI command and noticed a memory leak issue while having object cache suspended. Turns out I had a has_category that filled the whole cache with category_relationships keys.

Change History (2)

Note: See TracTickets for help on using tickets.