1

I am getting this warning message when I go to store > configuration in the admin panel.

Warning: Invalid argument supplied for foreach() in /opt/lampp/htdocs/Magento2/vendor/magento/module-config/Model/Config/Structure/Mapper/Sorting.php

Posted my answer for the same. Need your suggestion in my answer.

  • I think issue is in following module app/code/Vendor/ModuleName/etc/adminhtml/system.xml file. – Shashank Gupta Jan 22 '18 at 7:59
  • did you face a similar issue and fixed it? The fix I answered is working but let me know if there is any other way to fix it. – Kalyan Chakravarthi V Jan 22 '18 at 8:02
  • Could you please do one thing? rename vendor folder and update composer once. – Pramod Kharade Jan 22 '18 at 8:05
  • 1
    yes, I got the similar issue , My case there is extra space issue , It is resolved by formatting system.xml file. – Shashank Gupta Jan 22 '18 at 8:09
  • 1
    Checked for tabs in the modules system.xml and removed them. It worked for me. Thanks. @PramodKharade tried composer update but the same issue persists if I don't remove the tabs in system.xml. – Kalyan Chakravarthi V Jan 22 '18 at 9:38
3

Two ways to fix this issue.

  1. Fixed 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 your XML file has any tab spacing within it. If so, remove the tab spacing and replace them with normal single spaces.

Not the answer you're looking for? Browse other questions tagged or ask your own question.