38 public function __construct(Inspector $inspector,
string $file_path,
string $file_name)
57 if (!is_dir($this->file_path)) {
74 $file_name = $this->file_path .
"/" . $this->file_name . self::FILE_FORMAT;
75 $stream = fopen($file_name,
'w+');
76 fwrite($stream, $this->
content());
78 chmod($file_name, 0755);
91 return Formatter::formatExceptionPlain($this->inspector);
100 foreach ($this->
tables() as $title => $content) {
101 $ret .=
"\n\n-- $title --\n\n";
102 if (count($content) > 0) {
103 foreach ($content as
$key => $value) {
104 $key = str_pad((
string)
$key, self::KEY_SPACE);
109 $indentation = str_pad(
"", self::KEY_SPACE);
110 $value = implode(
"\n", array_map(
function ($line) use (&$first, $indentation) {
115 return $indentation . $line;
116 }, explode(
"\n", print_r($value,
true))));
118 $ret .=
"$key: $value\n";
139 return array(
"GET Data" =>
$_GET 140 ,
"POST Data" =>
$post 143 ,
"Session" => $_SESSION ?? array()
144 ,
"Server/Request Data" =>
$server 145 ,
"Environment Variables" => $_ENV
155 foreach ($this->exclusion_list as $parameter) {
156 if (isset($super_global[$parameter])) {
157 $super_global[$parameter] =
'REMOVED FOR SECURITY';
160 if (isset($super_global[
'post_vars'][$parameter])) {
161 $super_global[
'post_vars'][$parameter] =
'REMOVED FOR SECURITY';
165 return $super_global;
173 if (!isset($server[
"HTTP_COOKIE"])) {
176 $cookie_content = $server[
"HTTP_COOKIE"];
177 $cookie_content = explode(
";", $cookie_content);
179 foreach ($cookie_content as
$key => $content) {
180 $content_array = explode(
"=", $content);
181 if (trim($content_array[0]) == session_name()) {
182 $content_array[1] = substr($content_array[1], 0, 5) .
" (SHORTENED FOR SECURITY)";
183 $cookie_content[
$key] = implode(
"=", $content_array);
187 $server[
"HTTP_COOKIE"] = implode(
";", $cookie_content);
withExclusionList(array $exclusion_list)
__construct(Inspector $inspector, string $file_path, string $file_name)
Saves error informations into file.
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
shortenPHPSessionId(array $server)
Shorts the php session id.
tablesContent()
Get the header for the page.
hideSensitiveData(array $super_global)
exceptionContent()
Get a short info about the exception.
tables()
Get the tables that should be rendered.