Skip to content

Conversation

@ndossche
Copy link
Member

@ndossche ndossche commented Jan 6, 2023

Fixes GH-10234

We can't directly call xmlNodeSetContent, because it might encode the string
through xmlStringLenGetNodeList for types
XML_DOCUMENT_FRAG_NODE, XML_ELEMENT_NODE, XML_ATTRIBUTE_NODE.
In these cases we need to use a text node to avoid the encoding.
For the other cases, we can rely on xmlNodeSetContent because it is either
a no-op, or handles the content without encoding and clears the properties
field if needed.

…ribute value.

We can't directly call xmlNodeSetContent, because it might encode the string
through xmlStringLenGetNodeList for types
XML_DOCUMENT_FRAG_NODE, XML_ELEMENT_NODE, XML_ATTRIBUTE_NODE.
In these cases we need to use a text node to avoid the encoding.
For the other cases, we *can* rely on xmlNodeSetContent because it is either
a no-op, or handles the content without encoding and clears the properties
field if needed.

The test was taken from the issue report, for the test:
Co-authored-by: ThomasWeinert <[email protected]>

Closes phpGH-10245.
@ndossche
Copy link
Member Author

ndossche commented May 6, 2023

Rebased this and added some more testing. Is there someone who's able to review this? :)

@iluuu1994
Copy link
Member

Maybe @Girgias?

@Girgias
Copy link
Member

Girgias commented May 10, 2023

@beberlei has done some stuff on DOM IIRC. I will try and have a look if they don't respond quickly.

@ndossche ndossche requested a review from Girgias May 22, 2023 21:44
@beberlei
Copy link
Contributor

I have honestly lost the grasp of libxml understandering at some point, it took me a few weeks to get into it the last time. I see this change has all the test assertions so from that perspective 😀

Copy link
Member

@Girgias Girgias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's just approve, worst case someone will report a new bug :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants