Additional fix to error handling.
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Tue, 7 Dec 2010 16:04:34 +0000 (16:04 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Tue, 7 Dec 2010 16:04:34 +0000 (16:04 +0000)
CHANGELOG.txt
includes/errors.inc

index b4f0cf1e6bc342806881eca1238271135cde0f82..abe22c68e9056752c28cbfc705d8b8432105dd2d 100644 (file)
@@ -37,6 +37,7 @@ $ /includes/hooks.inc
 $ /admin/inst_module.php
   /includes/main.inc
   /includes/session.inc
+  /includes/errors.inc
 
 03-Dec-2010 Janusz Dobrowolski
 # Fixed company prefs refresh after upgrade/restore
index c584d175f79e831d3855d0fb672910e55c8df844..bcb3cd3f99e1b064257a74352f2c890d2e64959a 100644 (file)
@@ -31,10 +31,11 @@ function error_handler($errno, $errstr, $file, $line) {
        // error_reporting==0 when messages are set off with @ 
        if ($errno & error_reporting())
                        $messages[] = array($errno, $errstr, $file, $line);
-       else if($errno&~E_NOTICE)// log all not displayed messages 
-               error_log(user_company() . ':' . $_SESSION["wa_current_user"]->loginname.':'
-                        . basename($file) .":$line:" . ( $SysPrefs->db_ok ? '':'[before upgrade]')
-                        . " $errstr");
+       else if($errno&~E_NOTICE) { // log all not displayed messages 
+               $user = @$_SESSION["wa_current_user"]->loginname;
+               $context = isset($SysPrefs) && !$SysPrefs->db_ok ? '[before upgrade]' : '';
+               error_log(user_company() . ":$user:". basename($file) .":$line:$context $errstr");
+       }
        
     return true;
 }