diff --git a/bootstrap.php b/bootstrap.php index 82c6d5d..5a5e076 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -40,10 +40,13 @@ if (!isset($CFG->dataroot)) { // 1) Make sure we replace the configurations for behat as we have not ran 'lib/setup.php' yet. if (!empty($CFG->behat_wwwroot) or !empty($CFG->behat_dataroot) or !empty($CFG->behat_prefix)) { require_once(__DIR__.'/../../lib/behat/lib.php'); + + // The function call below will change $CFG so let's save it and restore later if access is granted. + $beforebehatcfg = $CFG; + $CFG = clone($CFG); behat_update_vars_for_process(); + if (behat_is_test_site()) { - $beforebehatcfg = $CFG; - $CFG = clone($CFG); clearstatcache(); behat_check_config_vars(); behat_clean_init_config(); @@ -82,4 +85,5 @@ $CFG->auth_outage_bootstrap_loaded = true; // 5) Restore behat config as needed (let setup.php execute which is more complex than our quick-check). if (isset($beforebehatcfg)) { $CFG = $beforebehatcfg; + unset($beforebehatcfg); }