joomla/joomla-cms — pull request #2780 by Iazel (2014-01-10 18:47:50+00:00)
Title: Fix for $start > 2

If I've understood the code well `$item->tree` contains all the item's parents, plus itself.
My use of case: I want to display all child of the active menu with depth's level 4 (legacy code, don't ask me why so deep...)
In my case, `$path` is the active menu's tree and is a root menu, so $path contains only itself.
I think this condition check `!in_array($item->tree[$start - 2], $path)` isn't correct, because if the level I want for my submenu is greater than 2 (4) and the current active menu is its root, it will still unset the item, because `$item->tree[$start - 2]` (direct son of the root) will not be in `$path`!

I think this patch is a more correct version and I've already tested it and seems to work well, but I don't know if can cause other bugs with other use cases.