From 20c292c60566ae35e773fe67ed6e4ad88f9d6a3a Mon Sep 17 00:00:00 2001 From: Davide Iadeluca Date: Mon, 7 Oct 2024 18:00:59 +0200 Subject: [PATCH] fix(mentions): return early if xml null --- extensions/mentions/src/Formatter/UnparsePostMentions.php | 4 ++++ extensions/mentions/src/Formatter/UnparseTagMentions.php | 4 ++++ extensions/mentions/src/Formatter/UnparseUserMentions.php | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/extensions/mentions/src/Formatter/UnparsePostMentions.php b/extensions/mentions/src/Formatter/UnparsePostMentions.php index 78a692bfd5..e7866deab4 100644 --- a/extensions/mentions/src/Formatter/UnparsePostMentions.php +++ b/extensions/mentions/src/Formatter/UnparsePostMentions.php @@ -34,6 +34,10 @@ public function __construct(TranslatorInterface $translator) */ public function __invoke($context, $xml) { + if ($xml === null) { + return $xml; + } + $xml = $this->updatePostMentionTags($context, $xml); $xml = $this->unparsePostMentionTags($xml); diff --git a/extensions/mentions/src/Formatter/UnparseTagMentions.php b/extensions/mentions/src/Formatter/UnparseTagMentions.php index a0075cb310..c4d98debaf 100644 --- a/extensions/mentions/src/Formatter/UnparseTagMentions.php +++ b/extensions/mentions/src/Formatter/UnparseTagMentions.php @@ -24,6 +24,10 @@ class UnparseTagMentions */ public function __invoke($context, $xml) { + if ($xml === null) { + return $xml; + } + $xml = $this->updateTagMentionTags($context, $xml); $xml = $this->unparseTagMentionTags($xml); diff --git a/extensions/mentions/src/Formatter/UnparseUserMentions.php b/extensions/mentions/src/Formatter/UnparseUserMentions.php index 6ca5bb3dfd..cdba49b76a 100644 --- a/extensions/mentions/src/Formatter/UnparseUserMentions.php +++ b/extensions/mentions/src/Formatter/UnparseUserMentions.php @@ -35,6 +35,10 @@ public function __construct(TranslatorInterface $translator) */ public function __invoke($context, $xml) { + if ($xml === null) { + return $xml; + } + $xml = $this->updateUserMentionTags($context, $xml); $xml = $this->unparseUserMentionTags($xml);