From 291b9957ad722179deca738703725487a38eba1e Mon Sep 17 00:00:00 2001 From: Hannes Papenberg Date: Tue, 17 Oct 2023 22:15:03 +0200 Subject: [PATCH] [5.0] MailTemplate: Prevent notice in replaceTags (#41679) * MailTemplate: Prevent notice in replaceTags * Update libraries/src/Mail/MailTemplate.php Co-authored-by: Quy * Update MailTemplate.php --------- Co-authored-by: Quy --- libraries/src/Mail/MailTemplate.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libraries/src/Mail/MailTemplate.php b/libraries/src/Mail/MailTemplate.php index 605c44339d07d..b74c2b67d17f5 100644 --- a/libraries/src/Mail/MailTemplate.php +++ b/libraries/src/Mail/MailTemplate.php @@ -325,6 +325,11 @@ public function send() protected function replaceTags($text, $tags) { foreach ($tags as $key => $value) { + // If the value is NULL, replace with an empty string. NULL itself throws notices + if (\is_null($value)) { + $value = ''; + } + if (\is_array($value)) { $matches = []; $pregKey = preg_quote(strtoupper($key), '/');