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