Make WordPress Core

Opened 6 years ago

Closed 5 years ago

#11047 closed defect (bug) (fixed)

admin edit pages could loop

Reported by: hailin Owned by:
Milestone: 3.1 Priority: normal
Severity: normal Version: 2.7
Component: General Keywords: needs-refresh 2nd-opinion
Focuses: Cc:


This is to continue #11018.

Display_page_row() in wp-admin/includes/template.php could loop forever, causing wp-admin/edit-pages.php not able to load at all.

We should break the loop and fix the pages dynamically when this happens.

Attachments (1)

11047_break_loop.diff (1.7 KB) - added by hailin 6 years ago.
correct patch

Download all attachments as: .zip

Change History (9)

#1 @hailin
6 years ago

westi suggested breaking the loop in _get_post_ancestors.

This patch breaks the loop right in display_page_row, and we've been running this patch on a live site for a week now and verified that it's working correctly.

#2 @hailin
6 years ago

_get_post_ancestors as we have the same bug there and then we can call that and use count() to get the depth we are at.

When there is a loop, we probably can not use count since it will return infinity.
We need to break out somehow, and return a dummy value such as 9999. Not sure it's going to be pretty.

6 years ago

correct patch

#3 @hailin
6 years ago

Attached the right patch.

_get_post_ancestors has the following comment:
The post parent will be an ancestor and the parent of the post

  • parent will be an ancestor. There will only be two ancestors at the most.

Based on the above comment, _get_post_ancestors doesn't have loop issue, and it appears that it was designed to have only two ancestors.

Therefore, the correct way to break pages loop is in display_page_row.

#4 @ryan
6 years ago

  • Milestone changed from 2.9 to 3.0

#5 @hakre
6 years ago

Related: #10277

#6 @ocean90
6 years ago

  • Keywords needs-refresh 2nd-opinion added

Related to #12443?

#7 @ryan
6 years ago

  • Milestone changed from 3.0 to 3.1

#8 @nacin
5 years ago

  • Milestone changed from Awaiting Triage to 3.1
  • Resolution set to fixed
  • Status changed from new to closed

Handled in [15758].

Note: See TracTickets for help on using tickets.