xref: /PHP-8.2/ext/simplexml/tests/bug27010.phpt (revision 7f2f0c00)
1--TEST--
2Bug #27010 (segfault and node text not displayed when returned from children())
3--EXTENSIONS--
4simplexml
5--FILE--
6<?php
7
8$xml=<<<EOF
9<drinks xmlns:hot="http://www.example.com/hot">
10 <hot:drink><hot:name>Coffee</hot:name></hot:drink>
11 <hot:drink><hot:name>Tea</hot:name></hot:drink>
12 <drink><name>Cola</name></drink>
13 <drink><name>Juice</name></drink>
14</drinks>
15EOF;
16
17$sxe = simplexml_load_string($xml);
18
19foreach ($sxe as $element_name => $element) {
20    print "$element_name is $element->name\n";
21}
22
23foreach ($sxe->children('http://www.example.com/hot') as $element_name => $element) {
24    print "$element_name is $element->name\n";
25}
26
27?>
28--EXPECT--
29drink is Cola
30drink is Juice
31drink is Coffee
32drink is Tea
33