[wp-trac] [WordPress Trac] #27538: Widget Customizer: Persistent object cache/Transients causes certain previewed widgets to leak outside of customizer

WordPress Trac noreply at wordpress.org
Sun Apr 6 18:47:48 UTC 2014


#27538: Widget Customizer: Persistent object cache/Transients causes certain
previewed widgets to leak outside of customizer
--------------------------+----------------------
 Reporter:  westonruter   |       Owner:  ocean90
     Type:  defect (bug)  |      Status:  closed
 Priority:  high          |   Milestone:  3.9
Component:  Widgets       |     Version:  trunk
 Severity:  normal        |  Resolution:  fixed
 Keywords:  has-patch     |     Focuses:
--------------------------+----------------------
Changes (by ocean90):

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


Comment:

 In [changeset:"27966"]:
 {{{
 #!CommitTicketReference repository="" revision="27966"
 WP_Widget: Introduce `is_preview()` method.

 With the Widget Customizer it's possible that previewed widgets can leak
 data outside of Customizer, when the widget uses the cache API.
 The Customizer calls the regular update callback which should already
 refresh the cache. Since cache additions aren't blocked yet the cache can
 be filled with preview data.
 To prevent this issue `WP_Widget::is_preview()` will return true, when
 `$wp_customize->is_preview()` returns true. If `is_preview()` is true,
 cache additions are suspended via `wp_suspend_cache_addition()`. Make sure
 your object cache drop-in has implemented `wp_suspend_cache_addition()`.

 `is_preview()` can/should also be used inside `WP_Widget::widget()`, see
 WP_Widget_Recent_Posts or WP_Widget_Recent_Comments for examples.

 For more info see IRC logs:
 http://irclogs.wordpress.org/chanlog.php?channel=wordpress-
 dev&day=2014-04-02&sort=asc#m824279

 props westonruter.
 fixes #27538.
 }}}

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


More information about the wp-trac mailing list