[php-src] Issue #11289: `DOMException: Not Found Error` introduced in 8.2.6, 8.1.19
| From: | fluffycondor | Date: | Mon, 22 May 2023 06:52:25 +0000 |
| Subject: | [php-src] Issue #11289: `DOMException: Not Found Error` introduced in 8.2.6, 8.1.19 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-244500@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/11289
Author: fluffycondor
### Description
Live reproduce: https://3v4l.org/AgHLn
The following code:
```php
<?php
$html = <<<HTML
<!DOCTYPE HTML>
<html>
<body>
<div></div>
</body>
</html>
HTML;
$dom = new DOMDocument();
$dom->loadHTML($html);
$divs = iterator_to_array($dom->getElementsByTagName('div')->getIterator());
foreach ($divs as $div) {
$fragment = $dom->createDocumentFragment();
$fragment->appendXML('<p>Hi!</p>');
$div->replaceWith(...$fragment->childNodes);
}
```
throws
DOMException: Not Found Error since 8.2.6 and 8.1.19.
Probably related to #11288.
### PHP Version
PHP 8.2.6, 8.1.19
### Operating System
FreeBSD 12.4, Windows 10 x64