WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 2 months ago

#21267 new defect (bug)

Kill the serialization of $wp_filter in get_terms() — at Version 1

Reported by: nacin Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: Cache API Keywords: has-patch 3.9-early
Focuses: Cc:

Description (last modified by scribu)

We use this as part of a persistent cache key:

serialize($GLOBALS['wp_filter']['list_terms_exclusions'])`

See [8225].

This is not good for two reasons. First, well, it's a not fun to reach into our internal API like that. But worse, it's broken whenever an object method is used, because spl_object_hash() will be unique to that object, thus rendering the cache invalidated on the next pageload.

As an aside, we should probably have _wp_filter_build_unique_id() create a delimiter when dealing with a static class method — $function[0].$function[1] can conflict with a legitimate function name.

I'm not sure how this should be fixed.

Change History (1)

comment:1 @scribu3 years ago

  • Description modified (diff)
  • Keywords needs-patch added

That looks incredibly hacky. Besides, closures are not serializable (you get a fatal error).

Note: See TracTickets for help on using tickets.