[wp-trac] Re: [WordPress Trac] #9661: cat_row doesn't not list all categories

WordPress Trac wp-trac at lists.automattic.com
Tue Apr 28 03:13:37 GMT 2009


#9661: cat_row  doesn't not list all categories
-------------------------------+--------------------------------------------
 Reporter:  hailin             |        Owner:  anonymous 
     Type:  defect (bug)       |       Status:  closed    
 Priority:  normal             |    Milestone:  Unassigned
Component:  General            |      Version:            
 Severity:  normal             |   Resolution:  invalid   
 Keywords:  reporter-feedback  |  
-------------------------------+--------------------------------------------

Comment(by hailin):

 Okay, he root cause is that unset($categories[$i])
 mistakenly unsets wrong element because it assumes
 the index always begins with 0, and auto-increments.  This is not the case
 with Array index - it can be anything, and even when it's numeric, it may
 not begin
 with 0 and auto-increments. I remembered running into a similar bug in
 walker class
 before.

 So the quick fix is to remember the $key, and unset( $categories[ $key ] )

 The second issue the new patch fixes is when the page starts in a subtree
 case.

 The third minor issue the new patch fixes is to pass children by ref,
 since
 we are not operating on it; and align the argument order to be consistent
 with that of the original.

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


More information about the wp-trac mailing list