History log of /php-src/ext/dom/tests/gh11500.phpt (Results 1 – 1 of 1)
Revision Date Author Comments
# 961e57eb 25-Jun-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix GH-11500: Namespace reuse in createElementNS() generates wrong output

When you construct a DOM tree containing subtrees which are constructed
top-down, this won't remove the redundan

Fix GH-11500: Namespace reuse in createElementNS() generates wrong output

When you construct a DOM tree containing subtrees which are constructed
top-down, this won't remove the redundant namespaces. That's because the
following conditions hold:
1) The namespace are reused from the doc->oldNs list.
2) Therefore during reconciliation no nsDef field is set, so no redundant
namespaces are removed by our reconciliation code.

Furthermore, it would only be fixed up automatically if the tree wasn't
added in bottom-up way, or if it had been constructed bottom-up from the
start.

Fix it by setting a flag to remove redundant namespaces in the libxml2
reconciliation call.
Since removing redundant namespaces may have a performance cost, we only do
this after performing a simple check.

Closes GH-11528.

show more ...