Add stackHash to ExceptionLogUtil
authorTim Düsterhus <duesterhus@woltlab.com>
Tue, 23 Jun 2020 14:17:56 +0000 (16:17 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Tue, 23 Jun 2020 14:17:56 +0000 (16:17 +0200)
wcfsetup/install/files/lib/util/ExceptionLogUtil.class.php

index 2318f78e252e220b4ab64cdc662549d7389c8784..90145409f0c064471781a6ae322eb73a0aca995a 100644 (file)
@@ -3,7 +3,7 @@ namespace wcf\util;
 use wcf\system\Regex;
 
 /**
- * Contains header-related functions.
+ * Contains helper functions to process the Exception log.
  * 
  * @author     Tim Duesterhus
  * @copyright  2001-2019 WoltLab GmbH
@@ -83,6 +83,14 @@ final class ExceptionLogUtil {
                        return $item;
                }, $chainRegex->getMatches());
                
+               $matches['stackHash'] = sha1(implode("\0", array_map(function ($item) {
+                       $result = "";
+                       foreach ($item['stack'] as $stack) {
+                               $result .= $stack['file']."\t".$stack['line']."\t".$stack['class'].$stack['type'].$stack['function']."\n";
+                       }
+                       return $result;
+               }, $chainMatches)));
+               
                $matches['date'] = strtotime($matches['date']);
                $matches['chain'] = $chainMatches;