I have a complex taxonomy with many parent and child terms that recently started to cause an endless import loop when using this module. To identify the issue, I started looking into the "while ($firstRun || count($tidsLeft) > 0)" logic as that's the code that appeared to be looping endlessly, but as I was debugging I had a hunch that it was related to how that logic attempts to support child terms appearing in the loop before their parent terms. So, as a test, I updated importTaxonomies to sort taxonomies so that all parent terms appear before their child terms in the relevant arrays, and this seemed to have fixed the problem.

I will attach a patch for others looking for a quick fix for this issue, though I'm uncertain if there should be a corresponding update -- or alternate approach altogether -- relating to that "while" logic I mentioned.

Comments

nwoodland created an issue. See original summary.

nwoodland’s picture

Here's the patch we're using for this issue currently.

nwoodland’s picture

StatusFileSize
new21.18 KB

Here's a sample taxonomy export that led to this issue.

  • nwoodland authored 3d54914 on 8.x-1.x
    Issue #3009375 by nwoodland: Taxonomy with parent and child terms can...
timkruijsen’s picture

Status: Active » Fixed

Patch looks good to me, included in release 1.14. Thanks for your effort!

nwoodland’s picture

Tim, glad to help! FYI that logic likely will only work 100% of the time for taxonomies that are one level deep, as it effectively ensures terms with no parent (parent = 0) appear first, but I assume this won't work the same for terms that are both parent and child terms, unless parent terms are consistently created before their children (so parents that are also children consistently point to a parent with a lower TID). Still, this simple sorting code shouldn't negatively impact anything and definitely corrects at least one known issue, so I hope this helps others!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.