-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Serializer] Add XmlEncoder::CDATA_WRAPPING
context option
#49893
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] Add XmlEncoder::CDATA_WRAPPING
context option
#49893
Conversation
Hey! I see that this is your first PR. That is great! Welcome! Symfony has a contribution guide which I suggest you to read. In short:
Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change. When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor! I am going to sit back now and wait for the reviews. Cheers! Carsonbot |
Failing checks seem unrelated to my changes |
I tested the changes from the PR and they work like a charm 👍 |
XmlEncoder::ENABLE_CDATA_WRAPPING
context option
XmlEncoder::ENABLE_CDATA_WRAPPING
context optionXmlEncoder::CDATA_WRAPPING
context option
7b9af66
to
c80761e
Compare
c80761e
to
049982d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed the remaining comments and renamed the option to CDATA_WRAPPING
Thank you @AndoniLarz. |
…CDATA wrapping opt-out context option (AndoniLarz) This PR was squashed before being merged into the 6.4 branch. Discussion ---------- [Serializer] Add documentation about a new XmlEncoder CDATA wrapping opt-out context option Add documentation of symfony/symfony#49893 which has been merged in 6.4. TODO : - [x] Fix conflicts (by rebasing) - [x] Edit the context option name (`enable_cdata_wrapping` => `cdata_wrapping`) - [x] Wait for the reviews Commits ------- 705d5d2 [Serializer] Add documentation about a new XmlEncoder CDATA wrapping opt-out context option
Usage example :
will output
instead of
As stated in the following comment from PHP.net : PHP automatically handles the escape when calling
DOMDocument::createTextNode
which is done in ::appendText.::appendText
is always called ifXmlEncoder::CDATA_WRAPPING => false
.Questions:
callable(string $val): bool
)'
and"
might also be escaped. Based on this should we instead provide a list of characters to escape/wrap ? (currently it would be set to['<', '>', '&']
)