Skip to content

Guard namespace prefix lookup for non-element nodes - #25762

Closed
imattas wants to merge 1 commit into
php:PHP-8.4from
imattas:dom-lookup-prefix-guard
Closed

imattas wants to merge 1 commit into
php:PHP-8.4from
imattas:dom-lookup-prefix-guard

Conversation

@imattas

@imattas imattas commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Description

Dom\Node::lookupPrefix() can reach the namespace-prefix helper with a non-element parent for text nodes inside DTD entity declarations. The helper reads element-specific namespace and attribute fields before checking the node type. Return NULL for non-elements and add a regression test for this case.

Testing

  • Minimal XML reproducer crashes before the guard and returns NULL after it in a local ASan build of PHP 8.7.0-dev.
  • ext/dom/tests/modern/spec/Node_lookupPrefix.phpt passes (1 test).

@devnexen devnexen closed this in f60216c Nov 27, 2026
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.

2 participants