[wp-trac] [WordPress Trac] #10440: is_active_sidebar not working as advertised

WordPress Trac wp-trac at lists.automattic.com
Mon Nov 9 00:33:31 UTC 2009


#10440: is_active_sidebar not working as advertised
--------------------------+-------------------------------------------------
 Reporter:  mortenf       |       Owner:  azaozz   
     Type:  defect (bug)  |      Status:  new      
 Priority:  normal        |   Milestone:  2.9      
Component:  Widgets       |     Version:  2.8.1    
 Severity:  normal        |    Keywords:  has-patch
--------------------------+-------------------------------------------------
Changes (by CharlesClarkson):

 * cc: cclarkson@… (added)


Comment:

 The patched function fails if a lower numbered sidebar is unregistered
 (unregister_sidebar()) than the one be searched for. In my test case I
 tried to test sidebar-5 by the sidebar name (Sidebar Top) after having
 removed sidebar-2. This version of the function has no way to "know" that
 an array key was unset and in a 5 sidebar theme (with 1 removed) it never
 tests for sidebar-5 because $i never gets that high.

 {{{
 register_sidebar(array('name'=>'Sidebar Bottom Left',));
 register_sidebar(array('name'=>'Sidebar Bottom Right',));
 register_sidebar(array('name'=>'468x60 Header Banner',));
 register_sidebar(array('name'=>'468x60 Post Banner',));
 register_sidebar(array('name'=>'Sidebar Top',));
 unregister_sidebar('sidebar-2');
 }}}

 This function also fails if the sidebar was registered with a different id
 from the default:
 {{{
 register_sidebar(array('name'=>'Sidebar Top','id'=>'top-sidebar'));
 }}}

 Without an internal id that cannot be changed by users, checking a sidebar
 by an integer ( is_active_sidebar(1) ) is not guaranteed to work.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/10440#comment:3>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list