General developer forum

Warning: Invalid argument supplied for foreach()

 
It's only an avatar...
Warning: Invalid argument supplied for foreach()
Core developersDocumentation writersParticularly helpful MoodlersPlugin developersTesters

WAMP server running on WINDOWS 10: APACHE / MySQL / PHP 7

All required SERVER settings and versions are correct for Moodle 3.6 (master)


I keep getting this error when I created a new Moodle site.

This is the actual WARNIING message:

Warning: Invalid argument supplied for foreach() in C:\wamp64\www\moodle36\lib\outputlib.php on line 800

How can I fix it?

Cheers

Mary


 
Average of ratings: -
Picture of Richard Oelmann
Re: Warning: Invalid argument supplied for foreach()
Core developersParticularly helpful MoodlersPlugin developersTesters

Which version of PHP7, Mary?

There are some things which appear to have changed about variable types (or maybe not changed but are more strictly enforced) in PHP7.2 over 7.0.

So far I've only upgraded dev sites rather than set up a new 3.6, and haven't updated to PHP7.2 yet, so I'm not saying that's the issue, just raising a possibility smile

 
Average of ratings: -
Picture of Matteo Scaramuccia
Re: Warning: Invalid argument supplied for foreach()
Core developersParticularly helpful MoodlersPlugin developers

Hi Mary,
are you running a "custom" theme?

        // cascade all layouts properly
        foreach ($baseconfig->layouts as $layout=>$value) {
            if (!isset($this->layouts[$layout])) {

It looks like an issue with the configuration of the theme.

HTH,
Matteo

 
Average of ratings: -