WordPress.org

Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#7697 closed defect (bug) (fixed)

Disallow page from being its own parent

Reported by: mtekk Owned by:
Milestone: 2.7 Priority: normal
Severity: normal Version: 2.7
Component: Administration Keywords: page parent
Focuses: Cc:

Description

I noticed this in the 2.7-hemorrhage branch that the dashboard page editor allows you to set the current page as its own parent. If this happens, many things break as PHP enters an infinite query loop. Two things should be done, not show it in the edit page. Additionally, when reading the parent_id, it should be checked to make sure it is not the same as the current page's ID this prevents the infinite loop from ever occurring from this condition. This was observed in r8822.

Change History (6)

#1 @mtekk
11 years ago

  • Summary changed from Disallow page being its own parent to Disallow page from being its own parent

#2 @mtekk
11 years ago

Looks like categories have this same problem in r8841. I'm going to make some patches for this.

#3 @mtekk
11 years ago

  • Version changed from 2.7 to 2.6

Ok for the page problem it looks like wp_dropdown_pages() is being called now instead of using parent_dropdown() and some surrounding code. If parent_dropdown is being depreciated, then wp_dropdown_pages() is going to need to be passed the excluded pages (which will have to be determined before calling it). It looks like even though it is supposed to be passed $post, $post ends up being NULL (so it does not even select the current parent page if there is one).

I'm opening a new ticket for a similar problem with categories as I found the problem exists in 2.6.1.

#4 @mtekk
11 years ago

  • Version changed from 2.6 to 2.7

#5 @ryan
11 years ago

wp_dropdown_pages() is more efficient than parent_dropdown() so 2.7 switched to it. parent_dropdown() will be deprecated. This definitely hasn't had enough testing since the switch. Thanks for looking into it.

#6 @mtekk
11 years ago

  • Resolution set to fixed
  • Status changed from new to closed

As of [9188] this seems to be fixed.

Note: See TracTickets for help on using tickets.