MDL-19077 - re-fix the problem of exceptions being thrown in $OUTPUT->header

Also, fix lines theme.
This commit is contained in:
tjhunt 2009-06-30 05:34:50 +00:00
parent b7337ab7ec
commit 7544d13c28
2 changed files with 13 additions and 9 deletions

View File

@ -155,13 +155,6 @@ function default_exception_handler($ex, $isupgrade = false, $plugin = null) {
$place = array('file'=>$ex->getFile(), 'line'=>$ex->getLine(), 'exception'=>get_class($ex));
array_unshift($backtrace, $place);
foreach ($backtrace as $stackframe) {
if (isset($stackframe['function']) && $stackframe['function'] == 'default_exception_handler') {
$earlyerror = true;
break;
}
}
if ($ex instanceof moodle_exception) {
$errorcode = $ex->errorcode;
$module = $ex->module;
@ -186,6 +179,18 @@ function default_exception_handler($ex, $isupgrade = false, $plugin = null) {
$CFG->debug = DEBUG_DEVELOPER;
}
// If another exception is thrown when we are already handling one, or during $OUTPUT->header,
// and if we did not take special measures, we would just get a very cryptic message
// "Exception thrown without a stack frame in Unknown on line 0", rather than the true error.
// Therefore, we do take special measures.
foreach ($backtrace as $stackframe) {
if (isset($stackframe['function']) && isset($stackframe['type']) &&
$stackframe['type'] == '->' && $stackframe['function'] == 'header') {
echo bootstrap_renderer::early_error($message, $moreinfourl, $link, debug_backtrace());
exit(1); // General error code
}
}
echo $OUTPUT->fatal_error($message, $moreinfourl, $link, debug_backtrace());
exit(1); // General error code
}
@ -800,7 +805,6 @@ class bootstrap_renderer {
$strerror = 'Error';
}
$output = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" ' . $htmllang . '>
<head>

View File

@ -1,6 +1,6 @@
<?php
$PAGE->requires->yui_lib('animation')->in_head(); ?>
echo $PAGE->requires->yui_lib('animation')->asap(); ?>
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="<?php echo $CFG->httpsthemewww ?>/lines/styles_ie7.css" />