foreach over a generator with an intermit send() fails with a fatal error
Aberta
php5 incompatibility
php7 incompatibility
- Linguagem predominante
- C++
- Estrelas
- 18.7k
- Forks
- 3.1k
- Merge médio
- 1h 47min
- PRs com merge (30d)
- 2
Descrição
### HHVM Version
hhvm-3.18.5 - 3.21.3, hhvm-3.22.0
### Operating System and Version
What 3v4l.org uses, probably Linux
### Standalone code, or other way to reproduce the problem
```php
/** @return Generator */
function example() {
for ($i = 0; $i < 5; $i += 1) {
$answer = (yield $i * 2);
echo "received: $answer\n";
}
}
$gen = example();
foreach ($gen as $x) {
echo "sending $x\n";
$gen->send($x);
}
```
[Demo here](https://3v4l.org/bfg64#vhhvm-3220)
### Expected result
No error.
### Actual result
Fatal error: Uncaught exception 'Exception' with message 'Generator is already finished'
Guia de contribuição
Avaliação
Esta issue ainda não foi avaliada.