Invalid argument supplied for foreach()
Closed this issue · 2 comments
Hello
I've installed subsection manager 2.1.2 under symphony 2.2.5
this worked fine until today... now if I try to enter in a data source to modify it or if I try to create a new one I get a Symphony Warning:
Invalid argument supplied for foreach()
An error occurred in ...\extensions\subsectionmanager\fields\field.subsectionmanager.php around line 834
the line triggering the error is this one:
foreach($elements as $element) {
Do you have any idea of what is going on?
Thanks
Daniele
Its likely this has been fixed in a later version with defensive coding so for your immediate fix, add if(!empty($elements)
to the start of the same line as the foreach
.
Also check that your manifest directory is writable and that you have selected included elements on the section editor for your SSM fields
Thanks for answering so fast!!!
Following your advice I changed the code like this:
if(!empty($elements)){
foreach($elements as $element) {
$includable[] = $this->get('element_name') . ': ' . $element;
}}
Now the data source are accessibile but I'm not sure I've made the fix in the right way...
Thanks
Daniele