LSerror: format error message at adding time

Format error message at adding time to make sure to be able to format 
it, even if the component triggered it is not loaded.
This commit is contained in:
Benjamin Renard 2020-08-07 16:11:32 +02:00
parent b0b50c51e4
commit 3ce495c2c3

View file

@ -69,7 +69,7 @@ class LSerror {
* @retval void
*/
public static function addErrorCode($code=null, $msg=null, $escape=true) {
$_SESSION['LSerror'][] = array($code, $msg, $escape);
$_SESSION['LSerror'][] = self :: formatError($code, $msg, $escape);
if (class_exists('LSlog'))
LSlog :: error(self :: formatError($code, $msg, $escape, 'addslashes'));
}
@ -127,7 +127,7 @@ class LSerror {
if(!empty($_SESSION['LSerror'])) {
$txt = '';
foreach ($_SESSION['LSerror'] as $error)
$txt .= call_user_func_array(array('LSerror', 'formatError'), $error)."<br />\n";
$txt .= $error."<br />\n";
self :: resetError();
return $txt;
}