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

WordPress Trac noreply at wordpress.org
Wed Aug 19 20:16:39 UTC 2015


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

Comment (by GregRoss):

 I have a similar problem, I tracked it down to changeset 32602.  In
 widgets.php, the display_callback function used to use:

 `if ( array_key_exists( $this->number, $instance ) ) {`

 but after the change it is now:

 `if ( isset( $instances[ $this->number ] ) ) {`

 This breaks if the instance data doesn't exist OR has been set to null
 (for example if you don't provide a return value in your widget's update
 override function because your storing the data somewhere else).

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


More information about the wp-trac mailing list