Closed
Closed
Copy link
Description
Symfony version(s) affected: 5.0
Description
If you start an XMLEncode::encode process in the middle of a normalization (you need to create an base64 encoded XML sub document), cause an "Wrong Document Error" DomDocument exception at:
Here is the call stack:
- The app call the serialize with: $serializer->serialize($data, "xml", [...context...]);
- The first serialize call the createDomDocument at:
- The XMLEncoder call normalizer at:
- In CustomNormalizer::normalize we call
$serializer->serialize($otherdata, "xml", [...other context...]); - Second serialize override dom at:
- When we done the normalization the encoder fails here because the second serializer did override the dom:
How to reproduce
Create an XML with an base64 encoded xml subcontent:
<?xml version="1.0"?>
<node>...base64encoded xml...</node>
xml to base64 encode:
<?xml version="1.0"?>
<node2>test</node2>
Possible Solution
DOMDocument of XMLEncoder should stackable.
Additional context
I will post repo, test and PR later.