We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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):
var_dump($sxe)
object(SimpleXMLElement)#1 (1) { ["comment"]=> object(SimpleXMLElement)#2 (0) { } }
So SimpleXML can handle it, kinda.
PHP 8.1+
Linux
The text was updated successfully, but these errors were encountered:
Fix phpGH-12170: Can't use xpath with comments in SimpleXML
7db9570
747335f
Merge branch 'PHP-8.1' into PHP-8.2
b3bce23
* PHP-8.1: Fix GH-12170: Can't use xpath with comments in SimpleXML
Merge branch 'PHP-8.2' into PHP-8.3
60b1673
* PHP-8.2: Fix GH-12170: Can't use xpath with comments in SimpleXML
Merge branch 'PHP-8.3'
e5252a3
* PHP-8.3: Fix GH-12170: Can't use xpath with comments in SimpleXML
Successfully merging a pull request may close this issue.
Description
The following code:
Resulted in this output:
But I expected this output instead:
However, you can see the comment node with
var_dump($sxe)
:So SimpleXML can handle it, kinda.
PHP Version
PHP 8.1+
Operating System
Linux
The text was updated successfully, but these errors were encountered: