mirror of
https://github.com/php/php-src.git
synced 2024-12-18 06:21:41 +08:00
45f7b2bcc8
Also fix a single instance of CRLF in ibase_query.c.
31 lines
476 B
PHP
31 lines
476 B
PHP
--TEST--
|
|
Bug #64979 (Wrong behavior of static variables in closure generators)
|
|
--FILE--
|
|
<?php
|
|
|
|
function new_closure_gen() {
|
|
return function() {
|
|
static $foo = 0;
|
|
yield ++$foo;
|
|
};
|
|
}
|
|
|
|
$closure1 = new_closure_gen();
|
|
$closure2 = new_closure_gen();
|
|
|
|
$gen1 = $closure1();
|
|
$gen2 = $closure1();
|
|
$gen3 = $closure2();
|
|
|
|
foreach (array($gen1, $gen2, $gen3) as $gen) {
|
|
foreach ($gen as $val) {
|
|
var_dump($val);
|
|
}
|
|
}
|
|
|
|
?>
|
|
--EXPECT--
|
|
int(1)
|
|
int(2)
|
|
int(1)
|