Global variable hack gone

Global variable hack gone

by Gustav W Delius -
Number of replies: 1
This morning Martin has finally switched off the automatic registration of global variables approve. I am of course happy to see that, I am just posting to alert all developers to the fact that they should search through their code for any calls to the obsolete require_variable() and optional_variable() functions because these will no longer work. The required_param() and optional_param() functions have taken their place.
Average of ratings: -
In reply to Gustav W Delius

Re: Global variable hack gone

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
Thanks, Gustav! approve

I think we converted everything in the core code but there will be hacks and third-party code that could be subject to problems if you have register_globals turned off on your server (as you should! tongueout)

Probably in the next version we'll remove require_variable() and optional_variable() completely (or at least make them print an error like "This code is not compatible with Moodle!").

Finally, note that if you really have problems (unlikely) then you can add this to your config.php to get the bad old behaviour back:

$CFG->enableglobalshack = true;