[php-src] Issue #12850: DOMNameSpaceNode parent not unset when namespace gets unlinked.
| From: | nielsdos | Date: | Sat, 02 Dec 2023 13:49:26 +0000 |
| Subject: | [php-src] Issue #12850: DOMNameSpaceNode parent not unset when namespace gets unlinked. | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-245958@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/12850
Author: nielsdos
### Description
The following code:
```php
<?php
$dom = new DOMDocument;
$dom->loadXML("<container xmlns=\"urn:foo\"/>");
$container = $dom->documentElement;
$ns = $container->getAttributeNode("xmlns");
var_dump($ns);
$container->removeAttributeNs("urn:foo", "");
var_dump($ns);
```
Resulted in this output:
```
first dump: DOMNameSpaceNode with parent node non-NULL (okay)
second dump: DOMNameSpaceNode with parent node non-NULL (not okay)
```
But I expected this output instead:
```
first dump: DOMNameSpaceNode with parent node non-NULL
second dump: DOMNameSpaceNode with parent node NULL
```
In versions prior to 8.1 the parent node was always NULL.
Mainly creating the issue so I don't forget about this.
### PHP Version
8.1+
### Operating System
_No response_