Skip to content

Commit c4937c0

Browse files
committed
Fix normalization
1 parent 887f0a6 commit c4937c0

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/XML/SerializableElementTrait.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ trait SerializableElementTrait
3131
public function __toString(): string
3232
{
3333
$xml = $this->toXML();
34+
3435
$doc = $xml->ownerDocument;
36+
$doc = Dom\XMLDocument::createFromString($doc->saveXml($doc->documentElement));
3537

3638
if (static::getNormalization() === true) {
3739
$normalized = DOMDocumentFactory::normalizeDocument($doc);
@@ -41,7 +43,6 @@ public function __toString(): string
4143

4244
// Non-normalized path
4345
$doc->formatOutput = $this->formatOutput;
44-
$doc->normalizeDocument();
4546
return $doc->saveXml($doc->documentElement);
4647
}
4748

0 commit comments

Comments
 (0)