Tuesday, January 30, 2018

Magento 2 - Warning: Invalid argument supplied for foreach() in the file vendor/magento/module-config/Model/Config/Structure/Mapper/Sorting.php

Two ways to fix this issue.
  1. Fixing it by changing the line 96 in this file vendor/magento/module-config/Model/Config/Structure/Converter.php.
Actual Code: if ($children->length && trim($child->nodeValue, "\n ") === '') {
Corrected Code: if ($children->length && trim($child->nodeValue, "\n\t ") === '') {
  1. Check if the XML file has any tab spacing within it. If so, remove the tab spacing and replace them with normal single spaces.