Cause of "Course module is incorrect" error in 1.6

Cause of "Course module is incorrect" error in 1.6

by Julian Ridden -
Number of replies: 2
A whol bunch of my contrib based code is no longer functioning in 1.6 and is generally generating the error "Course module is incorrect".

What is causing this? Would like to know so I can repair it ASAP.

Average of ratings: -
In reply to Julian Ridden

Re: Cause of "Course module is incorrect" error in 1.6

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Does this fix it?

   $CFG->enableglobalshack = true;

in your config.php.

This will probably get all that code running, but it's security risk to have all input automatically defined as globals (which is why it was disabled by default in 1.6). All the standard Moodle code should be working fine under the new setting.

Only code that does not follow the coding guide about using optional_param() and required_param() for all parameters will break. Such code needs to be fixed.
In reply to Martin Dougiamas

Re: Cause of "Course module is incorrect" error in 1.6

by Julian Ridden -
Works like a charm. Many thanks.

Sadly, looks like I have a fair amount of code to fix up. sad