mirror of
https://github.com/php/php-src.git
synced 2024-12-18 06:21:41 +08:00
16c4910876
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.
25 lines
379 B
PHP
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)
|