Skip to content

\Dom\ParentNode::querySelector and \Dom\ParentNode::querySelectorAll requires elements in $selectors to be lowercase #20395

Closed

Description

@DeveloperRob

Description

(Related: #17802 - in this issue there was a very similar issue, where if attribute names in $selectors didn't match the case of the attribute then the node was not matched.)

The following code:

<?php
$html   = "<!doctype html><html><head></head><body></body></html>";
$dom    = \Dom\HtmlDocument::createFromString($html);
var_dump(\is_null($dom->querySelector("html")));
var_dump(\is_null($dom->querySelector("Html")));
var_dump(\is_null($dom->querySelector("HTML")));

Resulted in this output:

bool(false)
bool(true)
bool(true)

But I expected this output instead:

bool(false)
bool(false)
bool(false)

PHP Version

All PHP8.4 versions and git.master (2025-09-27)

Operating System

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions