xref: /PHP-8.3/ext/simplexml/tests/gh12169.phpt (revision 82a84d0b)
1--TEST--
2GH-12169 (Unable to get comment contents in SimpleXML)
3--EXTENSIONS--
4simplexml
5--FILE--
6<?php
7
8$xml = <<<XML
9<?xml version="1.0"?>
10<container>
11    <!-- comment contents -->
12</container>
13XML;
14
15$sxe = simplexml_load_string($xml);
16
17var_dump($sxe->xpath("//comment()")[0]->getName());
18var_dump((string) $sxe->xpath("//comment()")[0]);
19
20?>
21--EXPECT--
22string(7) "comment"
23string(18) " comment contents "
24