[wp-trac] [WordPress Trac] #21267: Kill the serialization of $wp_filter in get_terms()

WordPress Trac noreply at wordpress.org
Tue Oct 13 03:06:29 UTC 2015


#21267: Kill the serialization of $wp_filter in get_terms()
--------------------------+---------------------------
 Reporter:  nacin         |       Owner:  boonebgorges
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:  4.4
Component:  Cache API     |     Version:
 Severity:  normal        |  Resolution:  fixed
 Keywords:  has-patch     |     Focuses:
--------------------------+---------------------------
Changes (by boonebgorges):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"35120"]:
 {{{
 #!CommitTicketReference repository="" revision="35120"
 Use a more reliable method for generating `get_terms()` cache key.

 Previously, the cache key included a serialization of
 `list_terms_exclusions`
 callbacks, to ensure that the cache was differentiated properly for
 different
 uses of the `list_terms_exclusions` filter. This strategy was flawed in a
 couple of ways: serialization doesn't work equally well for all callable
 types;
 the serialization required reaching into the `$wp_filter` global;
 serializing
 the callback itself didn't properly account for the possibility that the
 callback might return different values in different contexts; the cache
 key
 didn't account for other filters that similarly affect the cached values,
 such
 as `terms_clauses`.

 We skirt all these issues by concatenating the cache key using the SQL
 query
 string, which will reflect all filters applied earlier in `get_terms()`.

 Props boonebgorges, wonderboymusic.
 Fixes #21267.
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/21267#comment:19>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list