[wp-trac] [WordPress Trac] #12342: New widget option after calling register_widget creating empty widget

WordPress Trac wp-trac at lists.automattic.com
Tue Feb 23 00:36:39 UTC 2010


#12342: New widget option after calling register_widget creating empty widget
--------------------------+-------------------------------------------------
 Reporter:  jimisaacs     |       Owner:  azaozz                    
     Type:  defect (bug)  |      Status:  new                       
 Priority:  normal        |   Milestone:  2.9.3                     
Component:  Widgets       |     Version:  2.9.2                     
 Severity:  normal        |    Keywords:  widgets, options, defaults
--------------------------+-------------------------------------------------
 After I register a new widget class that has never been registered before,
 navigate to the widgets.php admin page and allow the option to be created
 automatically. The option value looks like this as serialized data:

 {{{
 a:2:{i:2;a:0:{}s:12:"_multiwidget";i:1;}
 }}}

 As you can see there is an empty widget in there for some reason.
 Basically the unserialized option value looks like the following as an
 array:

 {{{
 array( '2' => array(), _multiwidget => 1 );
 }}}

 This is odd behavior since the first multi number has always started at 2,
 but with that previous array in there it starts at 3, and randomly which
 is what irks me. i can't seem to find when it happens or a pattern, so
 naturally this feels like a bug.

 As this does not seem to break anything with the core functionality of
 WordPress, I would say this is normal priority. What this does do is pose
 many questions for those of us that dive deep into the Widget API, where
 our plugins and the functionality of them are dependent on how these
 things work. My widget plugin is quite large, and I need to know if I can
 depend on the first multi number of a widget when the class is first
 registered.

 If this is not a bug, and normal functionality, I apologize, and would
 like to ask for a heads up on the subject.

 Thank You,
 Jim Isaacs

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/12342>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list