mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-23797 improved detection of PAGE->context abuse andproblems; fixed incorrect use of this->context instead of this->_context; missing PAGE->context does not throw fatal error any more
This commit is contained in:
parent
df92ba9a43
commit
eb5bdb3510
4 changed files with 65 additions and 26 deletions
|
@ -963,18 +963,24 @@ class bootstrap_renderer {
|
|||
$recursing = is_early_init($backtrace);
|
||||
}
|
||||
|
||||
$earlymethods = array(
|
||||
'fatal_error' => 'early_error',
|
||||
'notification' => 'early_notification',
|
||||
);
|
||||
|
||||
// If lib/outputlib.php has been loaded, call it.
|
||||
if (!empty($PAGE) && !$recursing) {
|
||||
if (array_key_exists($method, $earlymethods)) {
|
||||
//prevent PAGE->context warnings - exceptions might appear before we set any context
|
||||
$PAGE->set_context(null);
|
||||
}
|
||||
$PAGE->initialise_theme_and_output();
|
||||
return call_user_func_array(array($OUTPUT, $method), $arguments);
|
||||
}
|
||||
|
||||
$this->initialising = true;
|
||||
|
||||
// Too soon to initialise $OUTPUT, provide a couple of key methods.
|
||||
$earlymethods = array(
|
||||
'fatal_error' => 'early_error',
|
||||
'notification' => 'early_notification',
|
||||
);
|
||||
if (array_key_exists($method, $earlymethods)) {
|
||||
return call_user_func_array(array('bootstrap_renderer', $earlymethods[$method]), $arguments);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue