Merge branch 'PHP-5.6' into PHP-7.0

Conflicts:
	ext/spl/spl_iterators.c
This commit is contained in:
Pierrick Charron 2016-07-26 20:36:34 -04:00
commit 2597f5d665
2 changed files with 22 additions and 1 deletions

View File

@ -1679,7 +1679,7 @@ static inline void spl_dual_it_rewind(spl_dual_it_object *intern)
{
spl_dual_it_free(intern);
intern->current.pos = 0;
if (intern->inner.iterator->funcs->rewind) {
if (intern->inner.iterator && intern->inner.iterator->funcs->rewind) {
intern->inner.iterator->funcs->rewind(intern->inner.iterator);
}
}

View File

@ -0,0 +1,21 @@
--TEST--
Bug #72684 (AppendIterator segfault with closed generator)
--FILE--
<?php
function createGenerator() { yield 1; }
$generator = createGenerator();
$appendIterator = new AppendIterator();
$appendIterator->append($generator);
iterator_to_array($appendIterator);
try {
iterator_to_array($appendIterator);
} catch (\Exception $e) {
echo $e->getMessage();
}
?>
--EXPECT--
Cannot traverse an already closed generator