[wp-trac] [WordPress Trac] #33442: Widgets not displayed if no $instance data is set

WordPress Trac noreply at wordpress.org
Thu Aug 20 22:19:07 UTC 2015


#33442: Widgets not displayed if no $instance data is set
--------------------------+--------------------
 Reporter:  johnnyb       |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  4.3.1
Component:  Widgets       |     Version:  4.3
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+--------------------

Comment (by westonruter):

 @GregRoss humm, Core is really expecting each widget instance to be
 represented as an array. If an `update` callback returned an object or a
 string, then I expect that a plugin could blow up when they try to amend
 the `$instance` array with additional data in the `widget_update_callback`
 filter (e.g. Jetpack's
 [https://github.com/Automattic/jetpack/blob/a1277200423558a99abf9a8f7c39fc7bb6a3e6e7/modules
 /widget-visibility/widget-conditions.php#L251-L306 Widget Conditions]).
 This filter is defined as passing around arrays, as is the
 `WP_Widget::update()` method defined as returning an array.

 That being said, the change for this ticket can probably just be returning
 to `array_key_exists()`, but at the same time I think it is perilous to
 try returning anything other than an array (or `false`) from an `update`
 method.

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


More information about the wp-trac mailing list