[php-src] Issue #18877: \Dom\HTMLDocument querySelectorAll selecting only the first when using ~ and :has

From: Date: Thu, 19 Jun 2025 13:12:20 +0000
Subject: [php-src] Issue #18877: \Dom\HTMLDocument querySelectorAll selecting only the first when using ~ and :has
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-250280@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/18877 Author: momala454 ### Description The following code: ```php <?php $text = <<<TEXT <html> <head> </head> <body> <div><div></div></div> <span></span> <span></span> <span></span> </body> </html> TEXT; $dom = \Dom\HTMLDocument::createFromString($text, options: LIBXML_NOERROR); var_dump($dom->querySelectorAll('div:has(div) ~ *')); ``` Resulted in this output: ``` object(Dom\NodeList)#3 (1) { ["length"]=> int(1) } ``` But I expected this output instead: ``` object(Dom\NodeList)#3 (1) { ["length"]=> int(3) } ``` ### PHP Version ```plain PHP 8.4.8 (cli) (built: Jun 11 2025 00:01:02) (NTS) Copyright (c) The PHP Group Built by https://github.com/docker-library/php Zend Engine v4.4.8, Copyright (c) Zend Technologies ``` ### Operating System _No response_

« previous php.bugs (#250280) next »