Fix Parserus: Instead of an offset in the list of children, the index of the child was used

This commit is contained in:
Visman 2023-06-17 19:58:41 +07:00
parent 9cf8967bb8
commit 47f9353595

View file

@ -1268,7 +1268,8 @@ class Parserus
return $this;
}
$idx = array_search($id, $this->data[$pid]['children']);
$key = array_search($id, $this->data[$pid]['children']);
$idx = array_search($key, array_keys($this->data[$pid]['children']));
$arrEnd = array_slice($this->data[$pid]['children'], $idx + 1);
$this->data[$pid]['children'] = array_slice($this->data[$pid]['children'], 0, $idx);
@ -1284,6 +1285,7 @@ class Parserus
}
$this->addTextNode((string) substr($this->data[$id]['text'], $pos), $pid);
unset($this->data[$id]);
$this->data[$pid]['children'] = array_merge($this->data[$pid]['children'], $arrEnd);