Download src/php/php-src/Zend/tests/generators/bug79927.phpt from meddyrat/dis-bench: direct link, hf CLI and curl.
- Browser
- Download file 549 Bytes
-
https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/tests/generators/bug79927.phpt
- Command line
-
hf download hf://datasets/meddyrat/dis-bench/src/php/php-src/Zend/tests/generators/bug79927.phpt
-
curl -L -o bug79927.phpt https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/tests/generators/bug79927.phpt
549 Bytes
| --TEST-- | |
| Bug #79927: Generator doesn't throw exception after multiple yield from iterable | |
| --FILE-- | |
| $generator = (function () { | |
| yield from [1, 2, 3]; | |
| })(); | |
| $generator->next(); | |
| $generator->next(); | |
| try { | |
| $generator->rewind(); | |
| } catch (Exception $e) { | |
| echo $e->getMessage(), "\n"; | |
| } | |
| echo $generator->current(), "\n"; | |
| $generator2 = (function () { | |
| yield from []; | |
| yield 4; | |
| })(); | |
| $generator2->current(); | |
| $generator2->rewind(); | |
| echo $generator2->current(), "\n"; | |
| --EXPECT-- | |
| Cannot rewind a generator that was already run | |
| 3 | |
| 4 | |