strip base dir in error reports to ensure privacy

This commit is contained in:
Steffen Schröder 2014-06-21 13:31:24 +02:00
parent c8d599189c
commit af01cf46c1

View File

@ -115,7 +115,7 @@ class ErrorHandler {
$report['Type'] = 'Error'; $report['Type'] = 'Error';
$report['Message'] = Formatter::utf8($message); $report['Message'] = Formatter::utf8($message);
if ($fileLine) { if ($fileLine) {
$report['FileLine'] = $fileLine; $report['FileLine'] = $this->stripBaseDir($fileLine);
} }
if ($sourceClass) { if ($sourceClass) {
$report['SourceClass'] = $sourceClass; $report['SourceClass'] = $sourceClass;
@ -237,7 +237,7 @@ class ErrorHandler {
} }
if (isset($traceStep['file']) && !$skipStep) { if (isset($traceStep['file']) && !$skipStep) {
$traceString .= ' in File '; $traceString .= ' in File ';
$traceString .= $traceStep['file']; $traceString .= $this->stripBaseDir($traceStep['file']);
} }
if (isset($traceStep['line']) && !$skipStep) { if (isset($traceStep['line']) && !$skipStep) {
$traceString .= ' on Line '; $traceString .= ' on Line ';
@ -336,6 +336,16 @@ class ErrorHandler {
return $string; 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 * Get the Source Class via the Error File
* *