Skip to content

Fix GH-17847: xinclude destroys live node #17878

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

Closed
wants to merge 3 commits into from

Conversation

nielsdos
Copy link
Member

dom_xinclude_strip_fallback_references() now also takes into account xi:include nodes children. This now subsumes all work done normally by the old start/end node removal, so we can remove that code and start using XML_PARSE_NOXINCNODE.

@nielsdos nielsdos linked an issue Feb 21, 2025 that may be closed by this pull request
dom_xinclude_strip_fallback_references() now also takes into account
xi:include nodes children. This now subsumes all work done normally by
the old start/end node removal, so we can remove that code and start
using XML_PARSE_NOXINCNODE.
* and remove the original nodes. If the originals are removed while there are still userland references
* this will cause memory corruption. */
static void dom_xinclude_strip_fallback_references(const xmlNode *basep)
static void dom_xinclude_strip_fallback_references(xmlDocPtr docp, const xmlNode *basep)
Copy link
Member

Choose a reason for hiding this comment

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

Why is the docPtr necessary here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Leftover from when I was playing around with this. Dropped.

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.

I can't see anything wrong now, so if CI is green feel free to merge.

@nielsdos
Copy link
Member Author

Also for future reference: the existing code to remove the xinclude start/end nodes wasn't right anyway as it only looked at the top level AFAICT

@nielsdos
Copy link
Member Author

Ah great, CI is red on some instances because libxml error messages are not consistent between versions :(
I slapped an @ on it

@Girgias
Copy link
Member

Girgias commented Feb 21, 2025

Win CI is unrelated.

@nielsdos nielsdos closed this in 9beccce Feb 21, 2025
charmitro pushed a commit to wasix-org/php that referenced this pull request Mar 13, 2025
dom_xinclude_strip_fallback_references() now also takes into account
xi:include nodes children. This now subsumes all work done normally by
the old start/end node removal, so we can remove that code and start
using XML_PARSE_NOXINCNODE.

Closes phpGH-17878.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

xinclude destroys live node
2 participants