Commit c81134dc authored by Markus Kalkbrenner's avatar Markus Kalkbrenner Committed by Markus Kalkbrenner
Browse files

Issue #3317585 by mkalkbrenner: Avoid endless loop in taxonomy hierarchy

parent de3498a5
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -147,7 +147,7 @@ class Taxonomy extends HierarchyPluginBase {
    $parentIds = [];
    $topLevelTerms = [];

    foreach ($ids as $id) {
    foreach ($ids as $key => $id) {
      if (!$activeIds || in_array($id, $activeIds)) {
        $currentParentIds = $this->getParentIds($id);
        if (!$currentParentIds) {
@@ -158,10 +158,12 @@ class Taxonomy extends HierarchyPluginBase {
            // Issue #3260603:
            // Due to a bug in core
            // https://www.drupal.org/project/drupal/issues/2723323
            // it may happen that a taxonomy term is still referenced in a field,
            // even though the term has been deleted.
            // Not checking the term is empty produces a fatal error.
            // it may happen that a taxonomy term is still referenced in a
            // field, even though the term has been deleted. Not checking the
            // term is empty produces a fatal error. The same could happen if
            // someone manipulates the query parameter.
            if (!$term instanceof TermInterface) {
              unset($ids[$key]);
              continue;
            }