mirror of
https://github.com/php/php-src.git
synced 2024-11-28 12:26:37 +08:00
Merge branch 'PHP-5.6' into PHP-7.0
Conflicts: ext/spl/spl_iterators.c
This commit is contained in:
commit
2597f5d665
@ -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);
|
||||
}
|
||||
}
|
||||
|
21
ext/spl/tests/bug72684.phpt
Normal file
21
ext/spl/tests/bug72684.phpt
Normal 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
|
Loading…
Reference in New Issue
Block a user