コード例 #1
0
function restore_stacktrace_by_map($stacktrace, $restore_map)
{
    $stack_info = get_stack_map($stacktrace);
    $stack = $stack_info->stack;
    $map = array();
    foreach ($stack as $info) {
        if (array_key_exists($info->method, $restore_map)) {
            $map[$info->method] = $restore_map[$info->method];
        }
    }
    foreach ($map as $key => $value) {
        $stacktrace = str_replace($key, $key . '<~~' . $value . '~~>', $stacktrace);
    }
    return $stacktrace;
}
コード例 #2
0
ファイル: MantisAcra.php プロジェクト: since2014/MantisAcra
 function build_acra_issue_fingerprint($stack_trace, $packages, $pid)
 {
     $decoded = get_stack_map($stack_trace);
     $exception = $decoded->exception;
     $exception = preg_replace('/:?\\s+.*$/i', '', $exception);
     $lines = array();
     $lines[] = $exception;
     require "ProjectAcraExt.php";
     $app_packages = handle_project_package_list($packages);
     foreach ($decoded->stack as $entry) {
         $method = $entry->method;
         foreach ($app_packages as $pack => $len) {
             if (strncmp($method, $pack, $len) === 0) {
                 $lines[] = $entry->method . $entry->suffix;
                 break;
             }
         }
     }
     if (count($lines) === 1) {
         //$lines[] = date("Y-m-d h:i:s");
         foreach ($decoded->stack as $entry) {
             $lines[] = $entry->method;
             //.$entry->suffix;
         }
     }
     $contents = implode("\n", $lines);
     error_log($pid . "stack trace:" . $stack_trace);
     error_log($pid . "fingerprint_text:" . $contents);
     return md5($contents);
 }