PHP Notice: Undefined property: stdClass::$instances

PHP Notice: Undefined property: stdClass::$instances

by Nicki Howes -
Number of replies: 1

I get the following Error in my PHPError.log file


[22-May-2007 02:09:12] PHP Notice:  Undefined property:  stdClass::$instances in D:\wamp\www\moodle\backup\backuplib.php on line 2110
[22-May-2007 02:09:12] PHP Warning:  Invalid argument supplied for foreach() in D:\wamp\www\moodle\backup\backuplib.php on line 2111

This is the code that it is referring to

/// adding mod contexts
        $mods = $preferences->mods;
        foreach ($mods as $modname => $mod) {
            $instances = $mod->instances;
            foreach ($instances as $id => $instance) {
                // if this type of mod is to be backed up
                if ($instance->backup) {
                    $cm = get_coursemodule_from_instance($modname, $id);
                    $context = get_context_instance(CONTEXT_MODULE, $cm->id);
                    // put context in array keys
                    $contexts[$context->id] = $context;
                }
            }
        }

I'm guessing it is something to do with the defining of the instances variable but I haven't changed the code since installing the latest version of Moodle and the errors have only just started to appear.  I'm only just beginning to learn PHP so I would be grateful for any help solving this error.

Thanks


Average of ratings: -
In reply to Nicki Howes

Re: PHP Notice: Undefined property: stdClass::$instances

by chris dennison -

Hi, I've had the same error upgrading tp 1.8.  It repeated 16 times - which is the same as the number of wikis on the home page.

The wikis backed up OK when I backed up manually