Skip to content

Commit aff47f2

Browse files
committed
BlueScreen: previous exception messages are formatted
1 parent dbbcd39 commit aff47f2

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/Tracy/BlueScreen/BlueScreen.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ public function renderToFile(\Throwable $exception, string $file): bool
123123
private function renderTemplate(\Throwable $exception, string $template, $toScreen = true): void
124124
{
125125
$showEnvironment = $this->showEnvironment && (strpos($exception->getMessage(), 'Allowed memory size') === false);
126-
$messageHtml = $this->formatMessage($exception);
127126
$info = array_filter($this->info);
128127
$source = Helpers::getSource();
129128
$title = $exception instanceof \ErrorException
@@ -370,7 +369,7 @@ public function getDumper(): \Closure
370369
}
371370

372371

373-
private function formatMessage(\Throwable $exception): string
372+
public function formatMessage(\Throwable $exception): string
374373
{
375374
$msg = Helpers::encodeString(trim((string) $exception->getMessage()), self::MAX_MESSAGE_LENGTH);
376375

src/Tracy/BlueScreen/assets/content.phtml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
* Copyright (c) 2004 David Grudl (https://davidgrudl.com)
88
*
99
* @param array $exception
10-
* @param string $messageHtml
1110
* @param array[] $actions
1211
* @param array $info
1312
* @param string $title
@@ -32,7 +31,7 @@ $code = $exception->getCode() ? ' #' . $exception->getCode() : '';
3231
<?php if ($exception->getMessage()): ?><p><?= Helpers::encodeString($title . $code, self::MAX_MESSAGE_LENGTH) ?></p><?php endif ?>
3332

3433

35-
<h1><span><?= $messageHtml ?: Helpers::encodeString($title . $code, self::MAX_MESSAGE_LENGTH) ?></span>
34+
<h1><span><?= $this->formatMessage($exception) ?></span>
3635
<?php foreach ($actions as $item): ?>
3736
<a href="<?= Helpers::escapeHtml($item['link']) ?>" class="action"<?= empty($item['external']) ? '' : ' target="_blank" rel="noreferrer noopener"'?>><?= Helpers::escapeHtml($item['label']) ?>&#x25ba;</a>
3837
<?php endforeach ?></h1>
@@ -56,7 +55,7 @@ $code = $exception->getCode() ? ' #' . $exception->getCode() : '';
5655
<div class="panel">
5756
<h2><?= Helpers::escapeHtml(Helpers::getClass($ex) . ($ex->getCode() ? ' #' . $ex->getCode() : '')) ?></h2>
5857

59-
<h2><?= Helpers::escapeHtml($ex->getMessage()) ?></h2>
58+
<h2><?= $this->formatMessage($ex) ?></h2>
6059
</div>
6160
<?php endif ?>
6261

0 commit comments

Comments
 (0)