From e543199b212ecca817689f76cdddf03f2457a852 Mon Sep 17 00:00:00 2001 From: hafsa-naeem <99266380+Hafsa-Naeem@users.noreply.github.com> Date: Sat, 15 Jun 2024 02:54:13 +0500 Subject: [PATCH] pkp/pkp-lib#10051 Fixed HTML entity code & in OJS email subject (#10052) * pkp/pkp-lib#10051 Fixed display & in email subjects to show correctly * pkp/pkp-lib#10051 Decode HTML entities in email subject during parameter replacement --- classes/mail/MailTemplate.inc.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/classes/mail/MailTemplate.inc.php b/classes/mail/MailTemplate.inc.php index 691c66ffc82..f352f4c6166 100644 --- a/classes/mail/MailTemplate.inc.php +++ b/classes/mail/MailTemplate.inc.php @@ -216,7 +216,7 @@ function send() { } /** - * Replace template variables in the message body. + * Replace template variables in the message body and subject. * @param $params array Parameters to assign (augments anything provided via setParams) */ function replaceParams() { @@ -231,9 +231,11 @@ function replaceParams() { $body = str_replace('{$' . $key . '}', $value, $body); } } - $subject = str_replace('{$' . $key . '}', $value, $subject); } + + // Decode HTML entities for the subject after all replacements + $subject = htmlspecialchars_decode($subject, ENT_QUOTES | ENT_HTML5); $this->setSubject($subject); $this->setBody($body); }