I hope final fix for warnings when using error() after print_header() with buffering on, solution was to flush all buffers and reenable SID rewrite when needed; merged from MOODLE_16_STABLE

This commit is contained in:
skodak 2006-05-14 17:23:29 +00:00
parent 38316f63a5
commit cc50d6664f
2 changed files with 8 additions and 2 deletions

View File

@ -1,4 +1,4 @@
<?php
<?php // $Id$
/**
* Enable cookieless sessions by including $CFG->usesid=true;
* in config.php.
@ -116,7 +116,7 @@ function sid_start_ob(){
}
}
}
ini_set("session.use_trans_sid", "true"); // try and turn on trans_sid
@ini_set("session.use_trans_sid", "true"); // try and turn on trans_sid
if (ini_get("session.use_trans_sid")!=0 ){
// use trans sid as its available
ini_set("url_rewriter.tags", "a=href,area=href,script=src,link=href,"

View File

@ -4029,6 +4029,12 @@ function print_scale_menu_helpbutton($courseid, $scale) {
function error ($message, $link='') {
global $CFG, $SESSION;
// flush all buffers so that we know if headers were already sent
while (@ob_end_flush());
// reenable SID rewrite if needed
if (!empty($CFG->usesid) and empty($_COOKIE['MoodleSession'.$CFG->sessioncookie])) {
sid_start_ob();
}
if (!headers_sent()) {
//header not yet printed
@header('HTTP/1.0 404 Not Found');