xref: /PHP-8.2/ext/simplexml/tests/gh15837.phpt (revision b5834c12)
1--TEST--
2GH-15837 (Segmentation fault in ext/simplexml/simplexml.c)
3--CREDITS--
4YuanchengJiang
5--FILE--
6<?php
7$xml =<<<EOF
8<xml>
9<fieldset1>
10</fieldset1>
11<fieldset2>
12<options>
13</options>
14</fieldset2>
15</xml>
16EOF;
17$sxe = new SimpleXMLIterator($xml);
18$rit = new RecursiveIteratorIterator($sxe, RecursiveIteratorIterator::LEAVES_ONLY);
19foreach ($rit as $child) {
20    $ancestry = $child->xpath('ancestor-or-self::*');
21    // Exhaust internal iterator
22    foreach ($ancestry as $ancestor) {
23    }
24}
25var_dump($rit->valid());
26var_dump($rit->key());
27?>
28--EXPECT--
29bool(false)
30NULL
31