[php-src] PR #23599: simplexml: filter addChild() result by the created element's namespace
| From: | iliaal | Date: | Sun, 06 Sep 2026 15:07:48 +0000 |
| Subject: | [php-src] PR #23599: simplexml: filter addChild() result by the created element's namespace | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-38349@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/23599
Author: iliaal
SimpleXMLElement::addChild() built the returned element with the prefix the caller
passed in rather than the one the new node ended up in, so a child added through that returned
object was filtered against the wrong namespace and could not be reached by property name. Taking
the prefix from newnode->ns fixes all three cases: an explicit a:kid
with a matching uri, a bare kid with a uri, and a bare kid under a
prefixed parent where xmlNewChild inherits the parent's prefix.
The filter keys on the prefix rather than the href deliberately. node_as_zval()
installs no filter at all when the prefix is null or empty, so switching to href matching would
start filtering the default-namespace case that currently has none.