[wp-trac] [WordPress Trac] #4910: Widgets might get "Array" as CSS class instead of classname

WordPress Trac wp-trac at lists.automattic.com
Wed Sep 5 12:13:38 GMT 2007


#4910: Widgets might get "Array" as CSS class instead of classname
---------------------+------------------------------------------------------
 Reporter:  f00f     |       Owner:  anonymous                  
     Type:  defect   |      Status:  new                        
 Priority:  high     |   Milestone:  2.3                        
Component:  General  |     Version:  2.3                        
 Severity:  minor    |    Keywords:  widgets css class has-patch
---------------------+------------------------------------------------------
 When register_sidebar_widget is called with two parameters only and the
 second one is an array, like
 {{{
 register_sidebar_widget(__('WdgName'), array('WdgClass', 'Method'));
 }}}
 then the CSS class attribute of the widget will contain 'Array' where it
 should contain the class_name.

 Fix: implode classname if it's an array.

 File: widgets.php[[BR]]
 Line: Replace line 213 with those two lines:
 {{{
 $classname_ = is_array($wp_registered_widgets[$id]['classname']) ?
 implode('_', $wp_registered_widgets[$id]['classname']) :
 $wp_registered_widgets[$id]['classname'];
 $params[0]['before_widget'] = sprintf($params[0]['before_widget'], $id,
 $classname_);
 }}}

 Btw: I do know (now) that there is a third parameter to
 register_sidebar_widget(), but we'd better be save than sorry.

 The fix should be absolutely save because only local variable is
 affected.[[BR]]
 Sorry for not providing a diff, how do I create one? (Win32)[[BR]]
 Easy fix, please include in 2.3 kthxbye ;)

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


More information about the wp-trac mailing list