[php-src] Issue #12167: No way to get the contents of a processing instruction in SimpleXML
| From: | nielsdos | Date: | Sat, 09 Sep 2023 19:50:38 +0000 |
| Subject: | [php-src] Issue #12167: No way to get the contents of a processing instruction in SimpleXML | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-245371@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/12167
Author: nielsdos
### Description
The following code:
```php
<?php
$xml = <<<XML
<?xml version="1.0" encoding="utf-8"?>
<foo>
<bar><?foo hello ?></bar>
</foo>
XML;
$sxe = simplexml_load_string($xml);
var_dump($sxe->xpath("//bar")[0]->getName());
var_dump((string) $sxe->xpath("//bar")[0]);
```
Resulted in this output:
```
string(3) "bar"
string(0) ""
```
But I expected this output instead:
```
string(3) "bar"
string(0) "hello"
```
### PHP Version
8.1+
### Operating System
Linux