php-src/Zend/tests/bug78752.phpt
Nikita Popov 16c4910876 Fix bug #78752
NULL out the execute_data before destroying it, otherwise GC may
trigger while the execute_data is partially destroyed, resulting
in double-frees.

The handling of call stack unfreezing is a bit awkward because it's
a ZEND_API function, so we can't change the signature.
2019-10-28 10:27:32 +01:00

25 lines
379 B
PHP

--TEST--
Bug #78752: Segfault if GC triggered while generator stack frame is being destroyed
--FILE--
<?php
function gen(&$gen) {
$a = new stdClass;
$a->a = $a;
$b = new stdClass;
$b->b = $b;
yield 1;
}
$gen = gen($gen);
var_dump($gen->current());
for ($i = 0; $i < 9999; $i++) {
$a = new stdClass;
$a->a = $a;
}
$gen->next();
?>
--EXPECT--
int(1)