Hide the full path to the file with the error
This commit is contained in:
parent
f04c994f7e
commit
24ac0f9547
1 changed files with 9 additions and 1 deletions
|
@ -22,6 +22,12 @@ class ErrorHandler
|
|||
*/
|
||||
protected $logged = false;
|
||||
|
||||
/**
|
||||
* Скрываемая часть пути до файла
|
||||
* @var string
|
||||
*/
|
||||
protected $hidePath;
|
||||
|
||||
/**
|
||||
* Список ошибок
|
||||
* @var array
|
||||
|
@ -56,6 +62,7 @@ class ErrorHandler
|
|||
|
||||
\ob_start();
|
||||
$this->obLevel = \ob_get_level();
|
||||
$this->hidePath = \realpath(__DIR__ . '/../../');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -182,8 +189,9 @@ class ErrorHandler
|
|||
|
||||
if (1 == \ini_get('display_errors')) {
|
||||
$type = isset($this->type[$error['type']]) ? $this->type[$error['type']] : $this->type[0];
|
||||
$file = \str_replace($this->hidePath, '...', $error['file']);
|
||||
|
||||
echo "PHP {$type}: \"{$error['message']}\" in {$error['file']}:[{$error['line']}]";
|
||||
echo "PHP {$type}: \"{$error['message']}\" in {$file}:[{$error['line']}]";
|
||||
} else {
|
||||
echo 'Oops';
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue