diff --git a/inc/html.php b/inc/html.php index 4e3744fd13396d87a5f6bd2d8f36bd5901b65d46..b6c5cc7ba6aff85c955a672417cec8b900dac88c 100644 --- a/inc/html.php +++ b/inc/html.php @@ -1034,7 +1034,10 @@ function html_conflict($text,$summary){ * @author Andreas Gohr <andi@splitbrain.org> */ function html_msgarea(){ - global $MSG; + global $MSG, $MSG_shown; + // store if the global $MSG has already been shown and thus HTML output has been started + $MSG_shown = true; + if(!isset($MSG)) return; $shown = array(); @@ -1046,6 +1049,8 @@ function html_msgarea(){ print '</div>'; $shown[$hash] = 1; } + + unset($GLOBALS['MSG']); } /** diff --git a/inc/infoutils.php b/inc/infoutils.php index d3c6f2918514ec2119e5fa01db679219a09d1383..5f406aa3e9990c0594883d941c196e2faee84b3b 100644 --- a/inc/infoutils.php +++ b/inc/infoutils.php @@ -258,7 +258,7 @@ function check(){ * @see html_msgarea */ function msg($message,$lvl=0,$line='',$file=''){ - global $MSG; + global $MSG, $MSG_shown; $errors[-1] = 'error'; $errors[0] = 'info'; $errors[1] = 'success'; @@ -268,7 +268,7 @@ function msg($message,$lvl=0,$line='',$file=''){ if(!isset($MSG)) $MSG = array(); $MSG[]=array('lvl' => $errors[$lvl], 'msg' => $message); - if(headers_sent()){ + if(isset($MSG_shown) || headers_sent()){ if(function_exists('html_msgarea')){ html_msgarea(); }else{