Ticket #5581 (closed defect: fixed)

Opened 11 months ago

Last modified 11 months ago

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

Reported by: hailin Assigned to: anonymous
Priority: normal Milestone: 2.5
Component: General Version:
Severity: normal Keywords:
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

wporg_patch.diff (1.2 kB) - added by hailin on 01/04/08 19:13:59.
patch

Change History

01/04/08 19:13:59 changed by hailin

  • attachment wporg_patch.diff added.

patch

01/04/08 19:17:42 changed by lloydbudd

  • description changed.

01/04/08 19:27:52 changed by hailin

  • 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.

01/04/08 19:55:18 changed by ryan

  • status changed from new to closed.
  • resolution set to fixed.

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