[php-src] Issue #10234: Setting DOMAttr::textContent results in an empty attribute value.
| From: | ThomasWeinert | Date: | Thu, 05 Jan 2023 14:47:53 +0000 |
| Subject: | [php-src] Issue #10234: Setting DOMAttr::textContent results in an empty attribute value. | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-243348@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/10234
Author: ThomasWeinert
### Description
The following code:
```php
<?php
$document = new DOMDocument();
$document->loadXML('<element attribute="value"/>');
$attribute = $document->documentElement->getAttributeNode('attribute');
// output loaded attribute value
var_dump($attribute->textContent);
// change value
$attribute->textContent = 'new value';
// output changed value
var_dump($attribute->textContent);
```
Resulted in this output:
```
string(5) "value"
string(0) ""
```
But I expected this output instead:
```
string(5) "value"
string(9) "new value"
```
https://3v4l.org/ouRV0
This work in PHP Versions 5.6.1 to 5.6.13, it is broken for any PHP version after that.
### PHP Version
PHP 8.2.1
### Operating System
_No response_