Skip to content

Commit

Permalink
I hope final fix for warnings when using error() after print_header()…
Browse files Browse the repository at this point in the history
… with buffering on, solution was to flush all buffers and reenable SID rewrite when needed.
  • Loading branch information
skodak committed May 14, 2006
1 parent 00fe4b8 commit c385f70
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/cookieless.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,"
Expand Down
7 changes: 7 additions & 0 deletions lib/weblib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -4049,6 +4055,7 @@ function error ($message, $link='') {
$link = $CFG->wwwroot .'/';
}
}

print_continue($link);
print_footer();
for ($i=0;$i<512;$i++) { // Padding to help IE work with 404
Expand Down

0 comments on commit c385f70

Please sign in to comment.