From af01cf46c15966a4b192a48d7084af73673cb619 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20Schro=CC=88der?= Date: Sat, 21 Jun 2014 13:31:24 +0200 Subject: [PATCH] strip base dir in error reports to ensure privacy --- application/core/ErrorHandler.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/application/core/ErrorHandler.php b/application/core/ErrorHandler.php index 63c7bcfc..994285b6 100644 --- a/application/core/ErrorHandler.php +++ b/application/core/ErrorHandler.php @@ -115,7 +115,7 @@ class ErrorHandler { $report['Type'] = 'Error'; $report['Message'] = Formatter::utf8($message); if ($fileLine) { - $report['FileLine'] = $fileLine; + $report['FileLine'] = $this->stripBaseDir($fileLine); } if ($sourceClass) { $report['SourceClass'] = $sourceClass; @@ -237,7 +237,7 @@ class ErrorHandler { } if (isset($traceStep['file']) && !$skipStep) { $traceString .= ' in File '; - $traceString .= $traceStep['file']; + $traceString .= $this->stripBaseDir($traceStep['file']); } if (isset($traceStep['line']) && !$skipStep) { $traceString .= ' on Line '; @@ -336,6 +336,16 @@ class ErrorHandler { return $string; } + /** + * Strip the ManiaControlDir from the given Path to ensure privacy + * + * @param string $path + * @return string + */ + private function stripBaseDir($path) { + return str_replace(ManiaControlDir, '', $path); + } + /** * Get the Source Class via the Error File *