### Description The following code: ```php <?php $sxe = simplexml_load_string(<<<XML <?xml version="1.0"?> <container> <!-- comment --> </container> XML); var_dump($sxe->xpath("//comment()")); ``` Resulted in this output: ``` array(0) { } ``` But I expected this output instead: ``` array(1) { [0] => the comment node } ``` However, you can see the comment node with `var_dump($sxe)`: ```php object(SimpleXMLElement)#1 (1) { ["comment"]=> object(SimpleXMLElement)#2 (0) { } } ``` So SimpleXML can handle it, kinda. ### PHP Version PHP 8.1+ ### Operating System Linux
Activity
Fix phpGH-12170: Can't use xpath with comments in SimpleXML
Merge branch 'PHP-8.1' into PHP-8.2
Merge branch 'PHP-8.2' into PHP-8.3
Merge branch 'PHP-8.3'
Fix phpGH-12170: Can't use xpath with comments in SimpleXML