xref: /PHP-7.3/ext/simplexml/tests/bug27010.phpt (revision 610c7fbe)
1--TEST--
2Bug #27010 (segfault and node text not displayed when returned from children())
3--SKIPIF--
4<?php if (!extension_loaded("simplexml")) print "skip"; ?>
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===DONE===
29--EXPECT--
30drink is Cola
31drink is Juice
32drink is Coffee
33drink is Tea
34===DONE===
35