Download src/php/php-src/Zend/tests/generators/bug79657.phpt from meddyrat/dis-bench: direct link, hf CLI and curl.
- Browser
- Download file 689 Bytes
-
https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/tests/generators/bug79657.phpt
- Command line
-
hf download hf://datasets/meddyrat/dis-bench/src/php/php-src/Zend/tests/generators/bug79657.phpt
-
curl -L -o bug79657.phpt https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/tests/generators/bug79657.phpt
689 Bytes
| --TEST-- | |
| Bug #79657: "yield from" hangs when invalid value encountered | |
| --FILE-- | |
| function throwException(): iterable | |
| { | |
| throw new Exception(); | |
| } | |
| function loop(): iterable | |
| { | |
| $callbacks = [ | |
| function () { | |
| yield 'first'; | |
| }, | |
| function () { | |
| yield from throwException(); | |
| } | |
| ]; | |
| foreach ($callbacks as $callback) { | |
| yield from $callback(); | |
| } | |
| } | |
| function get(string $first, int $second): array | |
| { | |
| return []; | |
| } | |
| get(...loop()); | |
| --EXPECTF-- | |
| Fatal error: Uncaught Exception in %s:%d | |
| Stack trace: | |
| #0 %s(%d): throwException() | |
| #1 %s(%d): {closure:%s:%d}() | |
| #2 %s(%d): loop() | |
| #3 {main} | |
| thrown in %s on line %d | |