[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
Wed Apr 2 04:36:43 UTC 2014


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

Comment (by David_Rothstein):

 Isn't this bug actually caused by the Recent Posts and Recent Comments
 widgets using a poorly-chosen (and non-unique) cache key?

 For example, you can reproduce a similar issue without using the Widget
 Customizer or a persistent cache plugin at all.  Just run these two lines
 of code:

 {{{
 echo the_widget( 'WP_Widget_Recent_Posts', array( 'title' => 'First title'
 ), array() );
 echo the_widget( 'WP_Widget_Recent_Posts', array( 'title' => 'Second
 title' ), array() );
 }}}

 The second one will be displayed with a title of "First title", not
 "Second title".

 I wrote a patch that fixes this by using a unique hash for the cache key
 (and will attach it now).  I tested it with the Memcached Object Cache
 plugin and the Widget Customizer and it seems to fix the bug.  This is my
 first Wordpress patch, so go easy on the review :)

 Also, based on the above it shouldn't be necessary to fix anything with
 setting transients here (since that's only a problem if there's code that
 sets a transient with a name that isn't unique to the data being cached).

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


More information about the wp-trac mailing list