-
Notifications
You must be signed in to change notification settings - Fork 8k
Closed
Description
Description
The following code:
<?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):
object(SimpleXMLElement)#1 (1) {
["comment"]=>
object(SimpleXMLElement)#2 (0) {
}
}So SimpleXML can handle it, kinda.
PHP Version
PHP 8.1+
Operating System
Linux
Reactions are currently unavailable