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

WordPress Trac wp-trac at lists.automattic.com
Fri Jul 13 23:46:28 UTC 2012


#21267: Kill the serialization of $wp_filter in get_terms()
--------------------------+------------------
 Reporter:  nacin         |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  3.5
Component:  Cache         |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |
--------------------------+------------------
Changes (by scribu):

 * keywords:   => needs-patch


Old description:

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

New description:

 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.

--

Comment:

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

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21267#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list