Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
[ticket/16958] Properly display paragraphs in messages
PHPBB3-16958
  • Loading branch information
marc1706 committed May 1, 2023
commit b54fa2bfd15f67e4b808ca69e7b390aa07d754ad
14 changes: 13 additions & 1 deletion phpBB/phpbb/debug/renderer/html_renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ protected function get_stack_trace(FlattenException $exception): array
$stack_item_data = [
'index' => $index,
'total' => $total,
'message' => $this->escape_html($stack_item['message']),
'message' => $this->separate_paragraphs($stack_item['message']),
'traces' => [],
];

Expand Down Expand Up @@ -261,4 +261,16 @@ private function escape_html(string $str): string
{
return htmlspecialchars($str, ENT_COMPAT, $this->charset);
}

/**
* Separate paragraphs of messages
*
* @param string $text Message to separate by paragraphs
*
* @return array|false|string[]
*/
private function separate_paragraphs(string $text)
{
return preg_split('/(<br>)+/', $text, -1, PREG_SPLIT_NO_EMPTY);
}
}
4 changes: 3 additions & 1 deletion phpBB/styles/all/template/exception.html
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ <h3 class="trace-class">
<abbr title="{{ stack_item.full_class }}">{{ stack_item.class }}</abbr>
</span>
</h3>
<p class="break-long-words trace-message">{{ stack_item.message }}</p>
{% for message in stack_item.message %}
<p class="break-long-words trace-message">{{ message }}</p>
{% endfor %}
</th>
</tr>
</thead>
Expand Down