The problem cames when there is bad nodes.
The solution :
function getChildrenByMatch($conditions, $recursive = true, $check_self =
false, $custom_filters = array()) {
$count = $this->childCount();
if ($check_self && $this->match($conditions, true, $custom_filters)) {
$res = array($this);
} else {
$res = array();
}
if ($count > 0) {
if (is_int($recursive)) {
$recursive = (($recursive > 1) ? $recursive - 1 : false);
}
for ($i = 0; $i < $count; $i++) {
++if (!isset($this->children[$i]))
++ continue;
if ($this->children[$i]->match($conditions, true, $custom_filters)) {
$res[] = $this->children[$i];
}
if ($recursive) {
$res = array_merge($res, $this->children[$i]->getChildrenByMatch($conditions, $recursive, false, $custom_filters));
}
}
}
return $res;
}
Thanks for this library
Original issue reported on code.google.com by
Alel...@gmail.comon 26 Nov 2014 at 1:59