Skip to content

Commit

Permalink
refactor: remove redundant HTML escaping in error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
edmondas committed Dec 5, 2023
1 parent ca24b54 commit 8419b5f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/Application/Presenter/ErrorPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@ private function sanitizeMessage(string $message): string

private function renderError(string $msg, ?string $name): void
{
$safeMsg = htmlspecialchars($msg, ENT_QUOTES, 'UTF-8');
$safeName = isset($name) ? htmlspecialchars($name, ENT_QUOTES, 'UTF-8') : null;
$errorContent = ($safeName !== null) ? "$safeMsg (Record: $safeName)" : $safeMsg;
$errorContent = ($safeName !== null) ? "$msg (Record: $safeName)" : $msg;

echo <<<HTML
<div class="alert alert-danger">
Expand Down

0 comments on commit 8419b5f

Please sign in to comment.