[php-src] Issue #23887: html5 parser crash: dom_html_collection_named_item: Assertion `iter.candidate->type == XML_ELEMENT_NODE' failed.
| From: | lmaltsis | Date: | Thu, 24 Sep 2026 13:08:49 +0000 |
| Subject: | [php-src] Issue #23887: html5 parser crash: dom_html_collection_named_item: Assertion `iter.candidate->type == XML_ELEMENT_NODE' failed. | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-252816@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/23887
Author: lmaltsis
### Description
The following code:
```php
<?php
Dom\HTMLDocument::createFromString(<<<a
<!DOCTYPE html>
<b id="container">
a)
->getElementById('container')
->getElementsByClassName('')
->namedItem("here");
```
Resulted in this output:
```sh
php: /home/user/software/php-install/src/ext/dom/html_collection.c:58:
dom_html_collection_named_item: Assertion `iter.candidate->type == XML_ELEMENT_NODE' failed.
Aborted
```
### PHP Version
```plain
PHP 8.7.0-dev (cli) (built: Sep 23 2026 15:02:26) (NTS DEBUG)
Copyright © The PHP Group and Contributors
Zend Engine v4.7.0-dev, Copyright © Zend by Perforce
with Zend OPcache v8.7.0-dev, Copyright ©, by Zend by Perforce
```
### Operating System
Ubuntu 24.04