[php-src] PR #23500: [SimpleXML] Fix creating new attributes via attributes() dimension write
| From: | iliaal | Date: | Sat, 29 Aug 2026 12:02:17 +0000 |
| Subject: | [php-src] PR #23500: [SimpleXML] Fix creating new attributes via attributes() dimension write | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-38194@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/23500
Author: iliaal
Dimension writes like $x->attributes()["new"] = "v" did nothing for a
not-yet-existing attribute, because sxe_prop_dim_write() replaced the element node with the first
attribute node while resolving an SXE_ITER_ATTRLIST iterator, so xmlNewProp() hit a non-element node
or never ran when the element had no attributes. sxe_prop_dim_write() now keeps the element node and
resolves only the start of the attribute list, making dimension writes on attributes() behave like
$x["new"] = "v". Property writes share this path and are fixed too; read,
exists, and unset create nothing and are unaffected.