示例#1
0
 /**
  * Renders blue screen.
  * @param  \Exception|\Throwable
  * @return void
  */
 public function render($exception)
 {
     $panels = $this->panels;
     $info = array_filter($this->info);
     $source = Helpers::getSource();
     $sourceIsUrl = preg_match('#^https?://#', $source);
     $title = $exception instanceof \ErrorException ? Helpers::errorTypeToString($exception->getSeverity()) : get_class($exception);
     $skipError = $sourceIsUrl && $exception instanceof \ErrorException && !empty($exception->skippable) ? $source . (strpos($source, '?') ? '&' : '?') . '_tracy_skip_error' : NULL;
     require __DIR__ . '/assets/BlueScreen/bluescreen.phtml';
 }
示例#2
0
 private function renderTemplate($exception, $template)
 {
     $info = array_filter($this->info);
     $source = Helpers::getSource();
     $sourceIsUrl = preg_match('#^https?://#', $source);
     $title = $exception instanceof \ErrorException ? Helpers::errorTypeToString($exception->getSeverity()) : Helpers::getClass($exception);
     $skipError = $sourceIsUrl && $exception instanceof \ErrorException && !empty($exception->skippable) ? $source . (strpos($source, '?') ? '&' : '?') . '_tracy_skip_error' : NULL;
     $lastError = $exception instanceof \ErrorException || $exception instanceof \Error ? NULL : error_get_last();
     $dump = function ($v) {
         return Dumper::toHtml($v, [Dumper::DEPTH => $this->maxDepth, Dumper::TRUNCATE => $this->maxLength, Dumper::LIVE => TRUE, Dumper::LOCATION => Dumper::LOCATION_CLASS]);
     };
     require $template;
 }
示例#3
0
 /**
  * Default mailer.
  * @param  string|\Exception|\Throwable
  * @param  string
  * @return void
  * @internal
  */
 public function defaultMailer($message, $email)
 {
     $host = preg_replace('#[^\\w.-]+#', '', isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : php_uname('n'));
     $parts = str_replace(["\r\n", "\n"], ["\n", PHP_EOL], ['headers' => implode("\n", ['From: ' . ($this->fromEmail ?: "noreply@{$host}"), 'X-Mailer: Tracy', 'Content-Type: text/plain; charset=UTF-8', 'Content-Transfer-Encoding: 8bit']) . "\n", 'subject' => "PHP: An error occurred on the server {$host}", 'body' => $this->formatMessage($message) . "\n\nsource: " . Helpers::getSource()]);
     mail($email, $parts['subject'], $parts['body'], $parts['headers']);
 }