Warning: Invalid argument supplied for foreach()

Warning: Invalid argument supplied for foreach()

by Mary Evans -
Number of replies: 3
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

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: -
In reply to Mary Evans

Re: Warning: Invalid argument supplied for foreach()

by Richard Oelmann -
Picture of Core developers Picture of Plugin developers Picture of Testers

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

In reply to Mary Evans

Re: Warning: Invalid argument supplied for foreach()

by Matteo Scaramuccia -
Picture of Core developers Picture of Peer reviewers Picture of Plugin 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

In reply to Matteo Scaramuccia

Re: Re: Warning: Invalid argument supplied for foreach()

by Todd W. Roat -
So does she/we fix it in more detail ;^)