New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Serializer] paralell XMLEncoder::encode can cause "Wrong Document Error" #37354
Comments
Here is a repo with a test file: |
Hey, thanks for your report! |
Friendly reminder that this issue exists. If I don't hear anything I'll close this. |
Hey, I didn't hear anything so I'm going to close it. Feel free to comment if this is still relevant, I can always reopen! |
…norhu) This PR was merged into the 4.4 branch. Discussion ---------- [Serializer] make XmlEncoder stateless thus reentrant | Q | A | ------------- | --- | Branch? | 5.x | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #37354 | License | MIT Changing dom property of XmlEncoder to stackable. It fixes a DOMException "Wrong document error". When you calling XmlEncoder->encode() in parallel createDomDocument replaces the DomDocument object. Test code: https://github.com/connorhu/symfony-serializer/blob/master/test.php Commits ------- 693f9ab [Serializer] make XmlEncoder stateless thus reentrant
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:
symfony/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php
Line 448 in 3e57f1f
Here is the call stack:
symfony/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php
Line 93 in 3e57f1f
symfony/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php
Line 415 in 3e57f1f
$serializer->serialize($otherdata, "xml", [...other context...]);
symfony/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php
Line 93 in 3e57f1f
symfony/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php
Line 448 in 3e57f1f
How to reproduce
Create an XML with an base64 encoded xml subcontent:
xml to base64 encode:
Possible Solution
DOMDocument of XMLEncoder should stackable.
Additional context
I will post repo, test and PR later.
The text was updated successfully, but these errors were encountered: