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:
Petr Skoda 2010-08-16 19:11:21 +00:00
parent df92ba9a43
commit eb5bdb3510
4 changed files with 65 additions and 26 deletions

View file

@ -1964,6 +1964,7 @@ EOD;
// can not be used from command line or when outputting custom XML
@header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found');
}
$this->page->set_context(null); // ugly hack - make sure page context is set to something, we do not want bogus warnings here
$this->page->set_url('/'); // no url
//$this->page->set_pagelayout('base'); //TODO: MDL-20676 blocks on error pages are weird, unfortunately it somehow detect the pagelayout from URL :-(
$this->page->set_title(get_string('error'));
@ -2581,6 +2582,9 @@ class core_renderer_ajax extends core_renderer {
*/
public function fatal_error($message, $moreinfourl, $link, $backtrace, $debuginfo = null) {
global $FULLME, $USER;
$this->page->set_context(null); // ugly hack - make sure page context is set to something, we do not want bogus warnings here
$e = new stdClass();
$e->error = $message;
$e->stacktrace = NULL;