Description
Calling Generator::send($value) on a fresh generator does not match PHP. PHP starts the generator, injects the sent value into the first suspended yield, and continues execution. The elephc binary instead returns the initial yielded value.
Minimal reproduction
<?php
function gen() {
$x = yield 10;
echo "|$x|";
}
$g = gen();
echo $g->send(99);
Steps to reproduce
- Save as
main.php.
- Run
php main.php.
- Compile and run with elephc.
Expected behavior
PHP 8.4 prints:
Actual behavior
The elephc-compiled binary prints:
Environment
- elephc 0.23.5
- PHP 8.4.19
- macOS arm64
- reproduced on 2026-06-05
Notes
This suggests the initial send() path is behaving like current()/first yield retrieval instead of the PHP resume semantics.
Description
Calling
Generator::send($value)on a fresh generator does not match PHP. PHP starts the generator, injects the sent value into the first suspendedyield, and continues execution. The elephc binary instead returns the initial yielded value.Minimal reproduction
Steps to reproduce
main.php.php main.php.Expected behavior
PHP 8.4 prints:
Actual behavior
The elephc-compiled binary prints:
Environment
Notes
This suggests the initial
send()path is behaving likecurrent()/firstyieldretrieval instead of the PHP resume semantics.