[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 01:24:58 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):

 From that PHP page:

 Note: Unless the array is referenced, foreach operates on a copy of the
 specified array and not the array itself. foreach has some side effects on
 the array pointer. Don't rely on the array pointer during or after the
 foreach without resetting it.

 I guess "some side effects" is the key issue.

 I've tracked down this issue by meticulously tracking what went wrong on a
 WordPress.com blog categories.  The category has 29 entries, yet the wp-
 admin/categories.php only lists 23 on two pages combined. Everything is
 perfect in DB. Once we unset the element, and after a few recursions, the
 original pointer behaves weirdly, and missed one subtree.

 If you want to verify it, try construct a category stree with at least two
 levels with at least 25 elements (or force per_page=5, and use less
 elements). It is easy to see that _cat_rows and cat_row will miss
 elements.

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


More information about the wp-trac mailing list