Browse Source

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

Visman 2 years ago
parent
commit
47f9353595
1 changed files with 3 additions and 1 deletions
  1. 3 1
      vendor/miovisman/parserus/Parserus.php

+ 3 - 1
vendor/miovisman/parserus/Parserus.php

@@ -1268,7 +1268,8 @@ class Parserus
                 return $this;
                 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);
             $arrEnd = array_slice($this->data[$pid]['children'], $idx + 1);
             $this->data[$pid]['children'] = array_slice($this->data[$pid]['children'], 0, $idx);
             $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);
             $this->addTextNode((string) substr($this->data[$id]['text'], $pos), $pid);
+
             unset($this->data[$id]);
             unset($this->data[$id]);
 
 
             $this->data[$pid]['children'] = array_merge($this->data[$pid]['children'], $arrEnd);
             $this->data[$pid]['children'] = array_merge($this->data[$pid]['children'], $arrEnd);