php-src/Zend/tests/bug75786.phpt
Nikita Popov fd30c59e04 Fixed bug #75786
SEND_UNPACK on iterators was duplicating references in-place,
which effectively leaks the original value and causes an off-by-one
refcount on the duplicated value.

Replace this with a deref, as an actual duplication is not even
needed in this case.
2018-01-09 20:20:31 +01:00

19 lines
303 B
PHP

--TEST--
Bug #75786: segfault when using spread operator on generator passed by reference
--FILE--
<?php
function &gen($items) {
foreach ($items as $key => &$value) {
yield $key => $value;
}
}
var_dump(...gen(['a', 'b', 'c']));
?>
--EXPECT--
string(1) "a"
string(1) "b"
string(1) "c"