[php-src] Issue #13737: `DOMXpath` and `DOM\Xpath` doesn't return the same result

From: Date: Sun, 17 Mar 2024 18:40:53 +0000
Subject: [php-src] Issue #13737: `DOMXpath` and `DOM\Xpath` doesn't return the same result
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-246597@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/13737 Author: alexandre-daubois ### Description The following code: ```php <?php $html = '<!DOCTYPE html><html lang="fr"><body><h1>Foo</h1></body></html>'; $node = \DOM\HTMLDocument::createFromString($html); $xpath = new \DOM\Xpath($node); $doc = new \DOMDocument(); $doc->loadHTML($html); $legacyXPath = new \DOMXpath($doc); var_dump( $xpath->query('//h1')->length, $legacyXPath->query('//h1')->length ); ``` Resulted in this output: ``` int(0) int(1) ``` But I expected this output instead: ``` int(1) int(1) ``` Encountered while working on leveraging the new DOM extension classes to Symfony DOM Crawler: https://github.com/symfony/symfony/issues/53666 ### PHP Version PHP 8.4 ### Operating System macOS 14.4

« previous php.bugs (#246597) next »