From e6d3f17975195df501f6773a3e2538104471b960 Mon Sep 17 00:00:00 2001 From: Touhidur Rahman Date: Fri, 16 Jun 2023 22:38:57 +0600 Subject: [PATCH] pkp/pkp-lib#9084 Mailable subject construction removing any html chars --- classes/mail/Mailable.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/classes/mail/Mailable.php b/classes/mail/Mailable.php index 1ea4abaeb0b..9ca7905d578 100644 --- a/classes/mail/Mailable.php +++ b/classes/mail/Mailable.php @@ -354,7 +354,11 @@ protected function addFooter(string $locale): self protected function buildSubject($message): self { $this->subject ??= ''; // Allow email with empty subject if not set - $subject = app('mailer')->compileParams($this->subject, $this->viewData); + $withoutTagViewData = collect($this->viewData) + ->map(fn(mixed $viewableData) => is_string($viewableData) ? strip_tags($viewableData) : $viewableData) + ->toArray(); + + $subject = app('mailer')->compileParams($this->subject, $withoutTagViewData); if (empty($subject)) { trigger_error( 'You are sending ' . static::getName() ?? static::class . ' email with empty subject',