From 7a4fcd69a38c94c267e0b6c582743ae6a686eef9 Mon Sep 17 00:00:00 2001 From: Kurt Thiemann Date: Wed, 5 Apr 2023 13:24:50 +0200 Subject: [PATCH] prevent writing raw list tag in different format --- src/Tag/ListTag.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Tag/ListTag.php b/src/Tag/ListTag.php index f537e8e..5076f51 100644 --- a/src/Tag/ListTag.php +++ b/src/Tag/ListTag.php @@ -22,6 +22,10 @@ public function writeContent(Writer $writer): static { $writer->getSerializer()->writeByte($this->contentTagType); if ($this->isRaw()) { + if($this->rawContentFormat !== $writer->getFormat()) { + throw new Exception("Cannot change format of raw list tag"); + } + $writer->getSerializer()->writeLengthPrefix($this->rawContentLength); $writer->write($this->rawContent); } else {