﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc
11018	display_page_row loops forever	hailin	hailin	"display_page_row() in wp-admin/includes/template.php  could loop forever, causing wp-admin/edit-pages.php not able to load at all. 

The root cause is that when a few pages are corrupted, such that they form a loop in a disconnected sub-graph. The disconnected sub-graph will be treated as orphans in page_rows since none of its elements points to a top level page.  

When one orphan page is passed to display_page_row( $op, 0 ), display_page_row will try to find out its ancestors.  It will hit an infinite loop, if the chain of ancestors pages form a loop. 

We should try to detect, break the loop, and fix the corrupted pages post_parent.  

The loop happens very rarely. But it does happen. We’ve seen it happening about once a week on a large scale WPMU installation.  I tried to reproduce it by editing and changing page parents with no avail.  Possible causes are cache pollution, and simultaneous operation by two admins, causing race condition in writing to DB. 

Nevertheless, it’s better to detect and fix the loops, otherwise, users can not access edit-pages.php. 

I further conclude that we only need to handle loop conditions in display_page_row.  Given our current algorithm, loops are only possible in disconnected sub-graphs, thus we don’t need to worry about it in page_rows or _page_rows. 
"	defect (bug)	closed	normal		Template	2.7	normal	duplicate	has-patch	Denis-de-Bernardy
