diff options
author | robocoder <anthon.pang@gmail.com> | 2011-06-25 16:25:12 +0400 |
---|---|---|
committer | robocoder <anthon.pang@gmail.com> | 2011-06-25 16:25:12 +0400 |
commit | af5275f8894153ca32aca8d6b9c04aa342f95830 (patch) | |
tree | 67b5105fb533d32758930c2bba8af1fddceb2373 /core/ErrorHandler.php | |
parent | a7620cdea23870d122cc6b9f6f09f5fd51e6783d (diff) |
fixes #2499, refs #2409
git-svn-id: http://dev.piwik.org/svn/trunk@4949 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'core/ErrorHandler.php')
-rw-r--r-- | core/ErrorHandler.php | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/core/ErrorHandler.php b/core/ErrorHandler.php index 0bddd55956..50e77dc1a2 100644 --- a/core/ErrorHandler.php +++ b/core/ErrorHandler.php @@ -26,28 +26,31 @@ function Piwik_ErrorHandler($errno, $errstr, $errfile, $errline) return; } - $backtrace = ''; - $bt = @debug_backtrace(); - if($bt !== null && isset($bt[0])) + if(function_exists('debug_backtrace')) { - //array_shift($bt); - foreach($bt as $i => $debug) + $backtrace = ''; + $bt = @debug_backtrace(); + if($bt !== null && isset($bt[0])) { - $args = isset($debug['args']) ? var_export($debug['args'], true) : ''; - $args = preg_replace( - array("/\n/", "/\r/", '/ +/', '/, *\)/', '/\( +/', '/^array \(0 => /', '/\)$/'), - array('', '', ' ', ')', '(', '', ''), - $args - ); - $backtrace .= "#$i " - .(isset($debug['class']) ? $debug['class'] : '') - .(isset($debug['type']) ? $debug['type'] : '') - .(isset($debug['function']) ? $debug['function'] : '') - .'('.$args.') called at [' - .(isset($debug['file']) ? $debug['file'] : '').':' - .(isset($debug['line']) ? $debug['line'] : '').']'."\n"; + foreach($bt as $i => $debug) + { + $backtrace .= "#$i " + .(isset($debug['class']) ? $debug['class'] : '') + .(isset($debug['type']) ? $debug['type'] : '') + .(isset($debug['function']) ? $debug['function'] : '') + .'(...) called at [' + .(isset($debug['file']) ? $debug['file'] : '').':' + .(isset($debug['line']) ? $debug['line'] : '').']'."\n"; + } } } + else + { + ob_start(); + @debug_print_backtrace(); + $backtrace = ob_get_contents(); + ob_end_clean(); + } try { Zend_Registry::get('logger_error')->logEvent($errno, $errstr, $errfile, $errline, $backtrace); |