Skip to content

Fix GH-21357: XSLTProcessor works with DOMDocument, but fails with Dom\XMLDocument#21371

Open
ndossche wants to merge 3 commits intophp:PHP-8.4from
ndossche:fix-21357
Open

Fix GH-21357: XSLTProcessor works with DOMDocument, but fails with Dom\XMLDocument#21371
ndossche wants to merge 3 commits intophp:PHP-8.4from
ndossche:fix-21357

Conversation

@ndossche
Copy link
Member

@ndossche ndossche commented Mar 7, 2026

Registering namespace after the parsing is too late because parsing can fail due to attributes referencing namespaces.
So we have to register fake namespaces before the parsing. However, the clone operation reconciles namespaces in the wrong way, so we have to clone via an object.

… Dom\XMLDocument

Registering namespace after the parsing is too late because parsing can
fail due to attributes referencing namespaces.
So we have to register fake namespaces before the parsing.
However, the clone operation reconciles namespaces in the wrong way, so
we have to clone via an object.
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.

The new logic seems sensible.

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.

XSLTProcessor works with \DOMDocument, but fails with \Dom\XMLDocument

3 participants