walker class special case
|Reported by:||hailin||Owned by:|
|Component:||General||Keywords:||has-patch, tested, reporter-feedback|
In function walk( $elements, $max_depth),
when none of the elements is top level (parent = 0)
we assume the first one must be root of the sub elements.
and get it as $root = $elements.
This implicitly assumes that the first index is 0.
In fact, in some cases, it can start with any integer.
It's observed that it can start with 2. When that happens,
walker will not construct any top level elements, end up treating
all as orphans.
The better and safe, way is to user array function:
$first = array_slice( $elements, 0, 1 );
$root = $first;
Change History (6)
comment:1 @lloydbudd — 6 years ago
- Keywords has-patch tested added
- Milestone changed from 2.8 to 2.7
- Version set to 2.7