Make WordPress Core

Opened 16 years ago

Closed 16 years ago

Last modified 3 years ago

#5581 closed defect (bug) (fixed)

some diff (index in display_element, and bad page handling) needs to be incorporated into wporg

Reported by: hailin's profile hailin Owned by:
Milestone: 2.5 Priority: normal
Severity: normal Version:
Component: General Keywords:
Focuses: Cc:

Description (last modified by lloydbudd)

I discovered this inconsistency, partly due to merge, between wporg and wpcom, and believe they should be incorporated into wporg.

In function display_element in Walk class.

i should be set to –1 in after the recursive call returns.

Consider the following example:
E1

  • e2
  • - e3
  • - - e4

And suppose children has order: e3, e2, e4 in the children array.

First we call display_element(E1), it will traverse children array, and find e2 as E1’s child; and the resulting array becomes e3, e4.

On the next recursive call, we are trying to find the child of e2 from the remaining children array.

Yet, with i--, it will start with e4, missing e3.

So this is a tricky case that is a little hard to imagine.
However, we already saw this happening with very complicated page hierarchy in wpcom.

Therefore, we have to reset index i to –1 so that on next call, it begins with index 0.

The catch and repair bad page diff is self-explanatory.

Attachments (1)

wporg_patch.diff (1.2 KB) - added by hailin 16 years ago.
patch

Download all attachments as: .zip

Change History (5)

@hailin
16 years ago

patch

#1 @lloydbudd
16 years ago

  • Description modified (diff)

#2 @hailin
16 years ago

  • Summary changed from some diff which needs to be incorporated into wporg to some diff (index in display_element, and bad page handling) needs to be incorporated into wporg

#3 @ryan
16 years ago

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

(In [6552]) Page walk fixes from hailin. fixes #5581

This ticket was mentioned in Slack in #core by metalandcoffee. View the logs.


3 years ago

Note: See TracTickets for help on using tickets.