Skip to content

html5 parser crash: dom_html_collection_named_item: Assertion `iter.candidate->type == XML_ELEMENT_NODE' failed. #23887

Closed

Description

@lmaltsis

Description

The following code:

<?php

Dom\HTMLDocument::createFromString(<<<a
<!DOCTYPE html>
<b id="container">

a)
    ->getElementById('container')
    ->getElementsByClassName('')
    ->namedItem("here");

Resulted in this output:

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

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

Activity

  1. added 3 commits that reference this issue on Sep 25, 2026
    388c230
    c1f025c
    604b6d7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions