[php-src] PR #25762: Guard namespace prefix lookup for non-element nodes
| From: | imattas | Date: | Wed, 25 Nov 2026 21:48:36 +0000 |
| Subject: | [php-src] PR #25762: Guard namespace prefix lookup for non-element nodes | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-41020@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/25762
Author: imattas
## 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).