[wp-trac] [WordPress Trac] #11424: Loops can develop in the post_parent hierarchy

WordPress Trac wp-trac at lists.automattic.com
Mon Dec 14 01:24:34 UTC 2009


#11424: Loops can develop in the post_parent hierarchy
--------------------------+-------------------------------------------------
 Reporter:  mdawaffe      |       Owner:                         
     Type:  defect (bug)  |      Status:  new                    
 Priority:  normal        |   Milestone:  3.0                    
Component:  General       |     Version:  2.9                    
 Severity:  normal        |    Keywords:  has-patch needs-testing
--------------------------+-------------------------------------------------
 It is possible to use wp_insert_post() to create a loop in the post_parent
 hierarchy.

 E.g.
 {{{
 ID = 1, post_parent = 3
 ID = 2, post_parent = 1
 ID = 3, post_parent = 2
 }}}

 The admin UI does not present this opportunity, but loops can happen
 elsewhere (e.g. imports, xmlrpc, etc.).

 wp_insert_post() only protects against loops with node length 1 or 2 (a
 post's post_parent is set to its own ID, or a two posts are parents of one
 another).  Longer loops are not caught.

 Attached uses a while loop to find and break any hierarchy loop.

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


More information about the wp-trac mailing list