From cc58224cff540373081dcde9c64d00efbf0fbddc Mon Sep 17 00:00:00 2001 From: Michael Hamann Date: Mon, 10 Jan 2011 21:54:58 +0100 Subject: Fix msg() calls when messages have already been printed This commit fixes two bugs that occurred when msg() was called after html_msgarea() had already been called. - the $MSG array is now cleared when it has been printed (otherwise $MSG has been printed again when another msg() call was done) - headers_sent() didn't work for me, it always reported false although html_msgarea() had already been called which might be explainable with output buffering. This makes msg() now depend on the first call of html_msgarea() or headers_sent() in order to not to break msg() in ajax requests etc. --- inc/html.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index 4e3744fd1..b6c5cc7ba 100644 --- a/inc/html.php +++ b/inc/html.php @@ -1034,7 +1034,10 @@ function html_conflict($text,$summary){ * @author Andreas Gohr */ 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 ''; $shown[$hash] = 1; } + + unset($GLOBALS['MSG']); } /** -- cgit v1.2.3