Merged changes form stabel branch up to the current state (2.3.22+).
[fa-stable.git] / includes / errors.inc
index 08a5e5781f6b6e421e087181b0709df02723b08e..1102271b658094677b6522362ce5bcf942cb7431 100644 (file)
@@ -62,7 +62,8 @@ function error_handler($errno, $errstr, $file, $line) {
        // Please use restrainedly to not risk loss of important messages
        $excluded_warnings = array(
                'html_entity_decode', 'htmlspecialchars',       // nevermind encodings, special chars are processed anyway
-               'should be compatible with that'                        // ignore cpdf/frontreport wrapper warnings
+               'should be compatible with that',                       // ignore cpdf/frontreport wrapper warnings
+               'mysql extension is deprecated'                         // ignore strict warning in 5.4
        );
        foreach($excluded_warnings as $ref) {
                if (strpos($errstr, $ref) !== false) {
@@ -93,7 +94,7 @@ function error_handler($errno, $errstr, $file, $line) {
 // FIX center is unused now
 function fmt_errors($center=false) {
     global $messages, $path_to_root, $go_debug;
-  
+
   $msg_class = array(
        E_USER_ERROR => 'err_msg',
        E_USER_WARNING =>'warn_msg', 
@@ -119,7 +120,7 @@ function fmt_errors($center=false) {
                                        $content = '';                  // clean other messages
                        }
                }
-               
+
            $str = $msg[1];
                if (!in_array($msg[0], array(E_USER_NOTICE, E_USER_ERROR, E_USER_WARNING)) && $msg[2] != null)
                  $str .= ' '._('in file').': '.$msg[2].' '._('at line ').$msg[3];
@@ -195,10 +196,14 @@ function display_db_error($msg, $sql_statement=null, $exit=true)
        }
        
        $str .= "<br><br>";
-       if($msg)
-               trigger_error($str, E_USER_ERROR);
-       else    // $msg can be null here only in debug mode, otherwise the error is ignored
-               trigger_error($str, E_USER_WARNING);
+       if ($go_debug)
+               error_log($str);
+       else {
+               if($msg)
+                       trigger_error($str, E_USER_ERROR);
+               else    // $msg can be null here only in debug mode, otherwise the error is ignored
+                       trigger_error($str, E_USER_WARNING);
+       }
        if ($exit)
                exit;
 }