]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-19077 - re-fix the problem of exceptions being thrown in $OUTPUT->header
authortjhunt <tjhunt>
Tue, 30 Jun 2009 05:34:50 +0000 (05:34 +0000)
committertjhunt <tjhunt>
Tue, 30 Jun 2009 05:34:50 +0000 (05:34 +0000)
Also, fix lines theme.

lib/setuplib.php
theme/lines/meta.php

index bfaa2231340b5643e08223686b9bb4aa85753a81..240e7df1b308d11c9b9de7543c7dae5eb86349c5 100644 (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>
index 762d879f1d162db3c745db75d791366d7899ba70..d6c65796b9585a5549caa79c2c2087712c64f5fb 100755 (executable)
@@ -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" />