Closed
Description
Description
Found while looking at #9735
The following code:
<?php
function f() {
}
$gen = function () use (&$gen) {
f($gen, yield);
};
$gen = $gen();
foreach ($gen as $value) {
break;
}
$gen = null;
gc_collect_cycles();
Resulted in this output:
[Fri Oct 14 15:51:40 2022] Script: 'gen.php'
Zend/zend_generators.c(409) : Freeing 0x00007fb3a365d3c0 (272 bytes), script=gen.php
=== Total 1 memory leaks detected ===
But I expected this output instead:
PHP Version
PHP 8.1 24c2970
Operating System
No response