Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ErrorHandler.php « modules - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0cd836bf9c92d657c8951f0f3963bd6fd0f5d632 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
/**
 * 
 * @package Piwik
 */
require_once "Zend/Registry.php"; 
function Piwik_ErrorHandler($errno, $errstr, $errfile, $errline)
{
    // if the error has been suppressed by the @ we don't handle the error
    if( error_reporting() == 0 )
    {
    	return;
    }

    ob_start();
    debug_print_backtrace();
    $backtrace = ob_get_contents();
    ob_end_clean();
    
    
    try {
    	Zend_Registry::get('logger_error')->log($errno, $errstr, $errfile, $errline, $backtrace);
    }catch(Exception $e){
    	// in case the error occurs before the logger creation, we simply display it
    	print("<pre>$errstr \nin '$errfile' at the line $errline\n\n$backtrace\n</pre>");
    	exit;
    }
	switch($errno)
	{
		case E_ERROR:
		case E_PARSE:
		case E_CORE_ERROR:
		case E_CORE_WARNING:
		case E_COMPILE_ERROR:
		case E_COMPILE_WARNING:
		case E_USER_ERROR:
		case E_EXCEPTION:
			exit;
		break;
		
		case E_WARNING:
		case E_NOTICE:
		case E_USER_WARNING:
		case E_USER_NOTICE:
		case E_STRICT:
		case E_RECOVERABLE_ERROR:
		default:
			// do not exit
		break;
    }
}