mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
We should check if the iterator data is still valid, because if it isn't, then the type info is UNDEF, but the pointer value may be dangling. Closes GH-15841.
31 lines
572 B
PHP
31 lines
572 B
PHP
--TEST--
|
|
GH-15837 (Segmentation fault in ext/simplexml/simplexml.c)
|
|
--CREDITS--
|
|
YuanchengJiang
|
|
--FILE--
|
|
<?php
|
|
$xml =<<<EOF
|
|
<xml>
|
|
<fieldset1>
|
|
</fieldset1>
|
|
<fieldset2>
|
|
<options>
|
|
</options>
|
|
</fieldset2>
|
|
</xml>
|
|
EOF;
|
|
$sxe = new SimpleXMLIterator($xml);
|
|
$rit = new RecursiveIteratorIterator($sxe, RecursiveIteratorIterator::LEAVES_ONLY);
|
|
foreach ($rit as $child) {
|
|
$ancestry = $child->xpath('ancestor-or-self::*');
|
|
// Exhaust internal iterator
|
|
foreach ($ancestry as $ancestor) {
|
|
}
|
|
}
|
|
var_dump($rit->valid());
|
|
var_dump($rit->key());
|
|
?>
|
|
--EXPECT--
|
|
bool(false)
|
|
NULL
|