From 69266de50f71b3d43011378cf0b0e8b8185c3609 Mon Sep 17 00:00:00 2001 From: Dominik Eckelmann <deckelmann@gmail.com> Date: Thu, 24 Jun 2010 14:26:15 +0200 Subject: [PATCH] fixed handling of MSG msg() now stores always the message to the MSG array until headers are sent. After this, a call of msg will print out all messages from the MSG array immediately through html_msgarea. This prevents double posting and losses of messages from the MSG array. --- inc/infoutils.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/inc/infoutils.php b/inc/infoutils.php index 32baa9450..096662d24 100644 --- a/inc/infoutils.php +++ b/inc/infoutils.php @@ -265,17 +265,15 @@ function msg($message,$lvl=0,$line='',$file=''){ if($line || $file) $message.=' ['.basename($file).':'.$line.']'; - if(!headers_sent()){ - if(!isset($MSG)) $MSG = array(); - $MSG[]=array('lvl' => $errors[$lvl], 'msg' => $message); - }else{ - $MSG = array(); - $MSG[]=array('lvl' => $errors[$lvl], 'msg' => $message); + if(!isset($MSG)) $MSG = array(); + $MSG[]=array('lvl' => $errors[$lvl], 'msg' => $message); + if(headers_sent()){ if(function_exists('html_msgarea')){ html_msgarea(); }else{ print "ERROR($lvl) $message"; } + unset($GLOBALS['MSG']); } } -- GitLab