We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Invalid argument supplied for foreach() - How to fix?

Development and Programming

andrew001's avatar
andrew001
136 posts
6 years ago
andrew001's avatar andrew001

EE 5.1.2

When I go to add a new field, or a new channel, I get the following… like.. a lot of the same error (15 or so)

Invalid argument supplied for foreach() ee/EllisLab/ExpressionEngine/View/_shared/form/section.php, line 20

Opening the file, it looks like this:

<?php foreach ($settings as $setting) { $this->embed(‘ee:_shared/form/fieldset’, array(‘setting’ => $setting, ‘group’ => FALSE)); } ?>

Also, mixed in with those errors, I get 2 of these:

ob_end_clean(): failed to delete buffer. No buffer to delete ee/EllisLab/ExpressionEngine/Service/View/View.php, line 138

and that line looks like:

$buffer = ob_get_contents(); ob_end_clean();

return $buffer; }

Any idea how to fix this? I dont get this on a clean install, so it might be some addon I had added (maybe expresso store or freeform pro) but I figured since it was in the ellislab folder, maybe I can post here.

       
andrew001's avatar
andrew001
136 posts
6 years ago
andrew001's avatar andrew001

So, I was able to fix the first issue by adding (array)

foreach ( (array) $settings as $setting)

Still hunting down #2

       
Derek Jones's avatar
Derek Jones
7,561 posts
6 years ago
Derek Jones's avatar Derek Jones

That’s not a fix, as any PHP errors in a view file are indicative of code further up the line not supplying expected values. Further, that will just get rewritten back to the default code when you update. Combined with the output buffer error, I suspect an installed add-on. You might var_dump() the $settings variable there, which could give a clue as to what’s going on, or run a debug_backtrace() and just see directly what the cause is.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.